2006-10-01 18:30:10 -04:00
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2008-12-18 07:41:56 -05:00
/*
2001-08-05 12:04:52 -04:00
* Copyright ( C ) 2001 Havoc Pennington , Anders Carlsson
2003-02-23 12:09:46 -05:00
* Copyright ( C ) 2002 , 2003 Red Hat , Inc .
* Copyright ( C ) 2003 Rob Adams
2006-01-10 14:43:21 -05:00
* Copyright ( C ) 2004 - 2006 Elijah Newren
2008-12-18 07:41:56 -05:00
*
2001-05-30 11:36:31 -04:00
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation ; either version 2 of the
* License , or ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful , but
* WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
* General Public License for more details .
2008-12-18 07:41:56 -05:00
*
2001-05-30 11:36:31 -04:00
* You should have received a copy of the GNU General Public License
2014-01-11 20:42:06 -05:00
* along with this program ; if not , see < http : //www.gnu.org/licenses/>.
2001-05-30 11:36:31 -04:00
*/
2013-03-11 11:52:36 -04:00
/**
2018-10-19 03:15:54 -04:00
* SECTION : meta - window
2013-03-11 11:52:36 -04:00
* @ title : MetaWindow
2018-10-19 03:15:54 -04:00
* @ short_description : A display - agnostic abstraction for a window .
*
* # MetaWindow is the core abstraction in Mutter of a window . It has the
2022-01-28 18:02:24 -05:00
* properties you ' d expect , such as a title , whether it ' s fullscreen ,
2018-10-19 03:15:54 -04:00
* has decorations , etc .
*
* Since a lot of different kinds of windows exist , each window also a
* # MetaWindowType which denotes which kind of window we ' re exactly dealing
* with . For example , one expects slightly different behaviour from a dialog
* than a " normal " window . The type of a window can be queried with
* meta_window_get_type ( ) .
*
* Common API for windows include :
* - Minimizing : meta_window_minimize ( ) / meta_window_unminimize ( )
* - Maximizing : meta_window_maximize ( ) / meta_window_unmaximize ( )
* - Fullscreen : meta_window_make_fullscreen ( ) / meta_window_unmake_fullscreen ( )
* / meta_window_is_fullscreen ( )
*
* Each # MetaWindow is part of either one or all # MetaWorkspace < ! - - - - > s of the
* desktop . You can activate a window on a certain workspace using
* meta_window_activate_with_workspace ( ) , and query on which workspace it is
* located using meta_window_located_on_workspace ( ) . The workspace it is part
* of can be obtained using meta_window_get_workspace ( ) .
*
* Each display protocol should make a subclass to be compatible with that
* protocols ' specifics , for example # MetaWindowX11 and # MetaWindowWayland .
* This is independent of the protocol that the client uses , which is modeled
* using the # MetaWindowClientType enum .
*
* To integrate within the Clutter scene graph , which deals with the actual
* rendering , each # MetaWindow will be part of a # MetaWindowActor .
2013-03-11 11:52:36 -04:00
*/
2018-07-10 04:36:24 -04:00
# include "config.h"
2001-06-06 00:47:37 -04:00
2018-07-10 04:36:24 -04:00
# include "core/window-private.h"
# include <math.h>
2013-03-04 09:57:01 -05:00
# include <stdlib.h>
2002-10-26 12:40:50 -04:00
# include <string.h>
2018-07-10 04:36:24 -04:00
# include <X11/Xatom.h>
2001-06-02 00:14:18 -04:00
2018-07-10 04:36:24 -04:00
# include "backends/meta-backend-private.h"
# include "backends/meta-logical-monitor.h"
2020-02-17 12:32:35 -05:00
# include "cogl/cogl.h"
2022-09-07 11:45:23 -04:00
# include "compositor/compositor-private.h"
2018-07-10 04:36:24 -04:00
# include "core/boxes-private.h"
# include "core/constraints.h"
# include "core/frame.h"
# include "core/keybindings-private.h"
# include "core/meta-workspace-manager-private.h"
# include "core/place.h"
# include "core/stack.h"
# include "core/util-private.h"
# include "core/workspace-private.h"
2013-10-03 15:29:44 -04:00
# include "meta/compositor-mutter.h"
2018-07-10 04:36:24 -04:00
# include "meta/group.h"
# include "meta/meta-cursor-tracker.h"
# include "meta/meta-enum-types.h"
# include "meta/meta-x11-errors.h"
# include "meta/prefs.h"
2017-08-26 12:26:30 -04:00
# include "x11/meta-x11-display-private.h"
2014-03-18 21:56:45 -04:00
# include "x11/window-props.h"
2018-07-10 04:36:24 -04:00
# include "x11/window-x11.h"
2014-03-18 21:56:45 -04:00
# include "x11/xprops.h"
2014-08-13 20:19:35 -04:00
# ifdef HAVE_WAYLAND
2018-07-10 04:36:24 -04:00
# include "wayland/meta-wayland-private.h"
# include "wayland/meta-wayland-surface.h"
2015-04-27 21:09:16 -04:00
# include "wayland/meta-window-wayland.h"
2022-06-13 04:09:26 -04:00
# endif
# ifdef HAVE_XWAYLAND
2017-08-30 03:17:41 -04:00
# include "wayland/meta-window-xwayland.h"
2014-08-13 20:19:35 -04:00
# endif
2014-03-18 22:01:31 -04:00
2021-08-05 10:35:18 -04:00
# ifdef HAVE_LIBSYSTEMD
# include <systemd/sd-login.h>
# endif
2012-03-12 12:09:17 -04:00
/* Windows that unmaximize to a size bigger than that fraction of the workarea
2012-03-15 15:42:11 -04:00
* will be scaled down to that size ( while maintaining aspect ratio ) .
* Windows that cover an area greater then this size are automaximized on map .
*/
2012-03-12 12:09:17 -04:00
# define MAX_UNMAXIMIZED_WINDOW_AREA .8
2017-09-26 17:22:43 -04:00
# define SNAP_SECURITY_LABEL_PREFIX "snap."
2015-03-14 19:03:23 -04:00
/* Each window has a "stamp" which is a non-recycled 64-bit ID. They
* start after the end of the XID space so that , for stacking
* we can keep a guint64 that represents one or the other
*/
2014-09-08 21:20:14 -04:00
static guint64 next_window_stamp = G_GUINT64_CONSTANT ( 0x100000000 ) ;
2001-06-09 17:58:30 -04:00
2003-02-27 20:24:44 -05:00
static void invalidate_work_areas ( MetaWindow * window ) ;
2014-02-01 19:03:33 -05:00
static void set_wm_state ( MetaWindow * window ) ;
2002-10-21 17:44:35 -04:00
static void set_net_wm_state ( MetaWindow * window ) ;
2011-07-02 07:08:17 -04:00
static void meta_window_set_above ( MetaWindow * window ,
gboolean new_value ) ;
2004-01-10 12:16:07 -05:00
2022-05-16 10:48:01 -04:00
static void meta_window_constructed ( GObject * object ) ;
2001-06-06 00:47:37 -04:00
static void meta_window_show ( MetaWindow * window ) ;
static void meta_window_hide ( MetaWindow * window ) ;
2016-01-10 09:16:09 -05:00
static void meta_window_save_rect ( MetaWindow * window ) ;
2004-08-05 13:48:39 -04:00
static void ensure_mru_position_after ( MetaWindow * window ,
MetaWindow * after_this_one ) ;
2022-01-28 18:21:59 -05:00
static void meta_window_unqueue ( MetaWindow * window ,
MetaQueueType queuebits ) ;
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
2011-02-28 05:41:23 -05:00
static gboolean should_be_on_all_workspaces ( MetaWindow * window ) ;
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
2006-01-20 17:03:56 -05:00
static void meta_window_flush_calc_showing ( MetaWindow * window ) ;
2001-06-21 23:20:21 -04:00
2005-05-26 13:15:56 -04:00
static gboolean queue_calc_showing_func ( MetaWindow * window ,
void * data ) ;
2011-05-20 04:56:12 -04:00
static void meta_window_move_between_rects ( MetaWindow * window ,
2018-11-06 07:35:31 -05:00
MetaMoveResizeFlags move_resize_flags ,
2011-05-20 04:56:12 -04:00
const MetaRectangle * old_area ,
const MetaRectangle * new_area ) ;
2001-07-27 00:36:44 -04:00
2006-04-16 23:54:49 -04:00
static void unmaximize_window_before_freeing ( MetaWindow * window ) ;
static void unminimize_window_and_all_transient_parents ( MetaWindow * window ) ;
2014-05-20 13:56:41 -04:00
static void meta_window_propagate_focus_appearance ( MetaWindow * window ,
gboolean focused ) ;
2014-08-16 13:22:05 -04:00
static void set_workspace_state ( MetaWindow * window ,
gboolean on_all_workspaces ,
MetaWorkspace * workspace ) ;
2017-06-11 21:13:03 -04:00
static MetaWindow * meta_window_find_tile_match ( MetaWindow * window ,
MetaTileMode mode ) ;
2017-08-16 23:43:21 -04:00
static void update_edge_constraints ( MetaWindow * window ) ;
2017-06-11 21:13:03 -04:00
2022-11-21 07:13:07 -05:00
static void initable_iface_init ( GInitableIface * initable_iface ) ;
2022-01-28 18:49:50 -05:00
typedef struct _MetaWindowPrivate
{
MetaQueueType queued_types ;
} MetaWindowPrivate ;
2006-01-20 18:36:23 -05:00
2022-11-21 07:13:07 -05:00
G_DEFINE_ABSTRACT_TYPE_WITH_CODE ( MetaWindow , meta_window , G_TYPE_OBJECT ,
G_ADD_PRIVATE ( MetaWindow )
G_IMPLEMENT_INTERFACE ( G_TYPE_INITABLE ,
initable_iface_init ) )
2008-11-07 04:57:00 -05:00
2018-12-19 03:04:25 -05:00
enum
{
2008-12-05 20:03:27 -05:00
PROP_0 ,
PROP_TITLE ,
PROP_ICON ,
2008-12-18 07:41:56 -05:00
PROP_MINI_ICON ,
2009-02-11 07:16:41 -05:00
PROP_DECORATED ,
2009-03-17 08:27:13 -04:00
PROP_FULLSCREEN ,
2010-02-12 15:26:52 -05:00
PROP_MAXIMIZED_HORIZONTALLY ,
PROP_MAXIMIZED_VERTICALLY ,
2011-05-31 13:52:04 -04:00
PROP_MINIMIZED ,
2009-08-31 12:06:53 -04:00
PROP_WINDOW_TYPE ,
2009-11-17 05:02:06 -05:00
PROP_USER_TIME ,
2009-11-20 03:51:19 -05:00
PROP_DEMANDS_ATTENTION ,
2010-01-18 05:12:17 -05:00
PROP_URGENT ,
2014-01-30 16:39:54 -05:00
PROP_SKIP_TASKBAR ,
2011-03-24 21:36:47 -04:00
PROP_MUTTER_HINTS ,
2011-03-03 04:01:04 -05:00
PROP_APPEARS_FOCUSED ,
2011-07-02 07:08:17 -04:00
PROP_RESIZEABLE ,
PROP_ABOVE ,
2011-11-25 18:42:41 -05:00
PROP_WM_CLASS ,
2012-01-17 13:27:10 -05:00
PROP_GTK_APPLICATION_ID ,
PROP_GTK_UNIQUE_BUS_NAME ,
PROP_GTK_APPLICATION_OBJECT_PATH ,
PROP_GTK_WINDOW_OBJECT_PATH ,
PROP_GTK_APP_MENU_OBJECT_PATH ,
2014-06-24 16:05:36 -04:00
PROP_GTK_MENUBAR_OBJECT_PATH ,
2014-06-24 16:18:26 -04:00
PROP_ON_ALL_WORKSPACES ,
2021-09-03 17:38:12 -04:00
PROP_IS_ALIVE ,
2022-05-16 10:48:01 -04:00
PROP_DISPLAY ,
PROP_EFFECT ,
PROP_XWINDOW ,
2014-06-24 16:18:26 -04:00
2018-02-10 07:36:48 -05:00
PROP_LAST ,
2008-12-05 20:03:27 -05:00
} ;
2018-02-10 07:36:48 -05:00
static GParamSpec * obj_props [ PROP_LAST ] ;
2014-06-24 16:18:26 -04:00
2009-01-20 07:52:06 -05:00
enum
{
WORKSPACE_CHANGED ,
2009-02-02 06:00:13 -05:00
FOCUS ,
2009-02-02 09:08:46 -05:00
RAISED ,
wayland: Move MetaWindow ownership to window owning roles
There are two surface roles owning a MetaWindow: MetaWaylandShellSurface
(basis of MetaWaylandXdgToplevel, MetaWaylandXdgPopup,
MetaWaylandWlShellSurface, etc), and MetaXwaylandSurface.
With these two role types, the MetaWindow has two different types of
life times. With MetaWaylandShellSurface, the window is owned and
managed by the role itself, while with MetaXwaylandSurface, the
MetaWindow is tied to the X11 window, while the Wayland surface and its
role plays more the role of the backing rendering surface.
Before, for historical reasons, MetaWindow was part of
MetaWaylandSurface, even though just some roles used it, and before
'wayland: Untie MetaWindowXwayland lifetime from the wl_surface' had
equivalent life times as well. But since that commit, the management
changed. To not have the same fied in MetaWaylandSurface being managed
in such drastically different ways, rearrange it so that the roles that
has a MetaWindow themself manages it in the way it is meant to; meaning
MetaWaylandShellSurface practically owns it, while with Xwayland, the
existance of a MetaWindow is tracked via X11.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
2019-10-09 03:57:40 -04:00
UNMANAGING ,
2009-10-13 10:34:34 -04:00
UNMANAGED ,
2013-12-06 15:39:24 -05:00
SIZE_CHANGED ,
POSITION_CHANGED ,
2018-07-12 04:25:16 -04:00
SHOWN ,
2009-01-20 07:52:06 -05:00
LAST_SIGNAL
} ;
static guint window_signals [ LAST_SIGNAL ] = { 0 } ;
2022-05-27 16:27:07 -04:00
static MetaBackend *
backend_from_window ( MetaWindow * window )
{
MetaDisplay * display = meta_window_get_display ( window ) ;
MetaContext * context = meta_display_get_context ( display ) ;
return meta_context_get_backend ( context ) ;
}
2011-11-25 19:52:24 -05:00
static void
prefs_changed_callback ( MetaPreference pref ,
gpointer data )
{
MetaWindow * window = data ;
2012-07-13 18:22:51 -04:00
if ( pref = = META_PREF_WORKSPACES_ONLY_ON_PRIMARY )
{
2014-08-16 13:22:05 -04:00
meta_window_on_all_workspaces_changed ( window ) ;
2012-07-13 18:22:51 -04:00
}
else if ( pref = = META_PREF_ATTACH_MODAL_DIALOGS & &
window - > type = = META_WINDOW_MODAL_DIALOG )
{
window - > attached = meta_window_should_attach_to_parent ( window ) ;
2014-02-01 18:58:58 -05:00
meta_window_recalc_features ( window ) ;
2012-07-13 18:22:51 -04:00
meta_window_queue ( window , META_QUEUE_MOVE_RESIZE ) ;
}
2019-10-12 14:55:26 -04:00
else if ( pref = = META_PREF_FOCUS_MODE )
{
meta_window_update_appears_focused ( window ) ;
}
2011-11-25 19:52:24 -05:00
}
2014-04-29 15:55:55 -04:00
static void
meta_window_real_grab_op_began ( MetaWindow * window ,
MetaGrabOp op )
{
}
static void
meta_window_real_grab_op_ended ( MetaWindow * window ,
MetaGrabOp op )
{
}
2014-05-20 15:46:21 -04:00
static void
meta_window_real_current_workspace_changed ( MetaWindow * window )
{
}
2014-04-28 17:06:38 -04:00
static gboolean
meta_window_real_update_struts ( MetaWindow * window )
{
return FALSE ;
}
2014-03-18 11:20:22 -04:00
static void
meta_window_real_get_default_skip_hints ( MetaWindow * window ,
gboolean * skip_taskbar_out ,
gboolean * skip_pager_out )
{
* skip_taskbar_out = FALSE ;
* skip_pager_out = FALSE ;
}
2020-04-08 10:13:38 -04:00
static pid_t
2016-10-07 11:55:32 -04:00
meta_window_real_get_client_pid ( MetaWindow * window )
{
return 0 ;
}
2008-11-07 04:57:00 -05:00
static void
meta_window_finalize ( GObject * object )
{
MetaWindow * window = META_WINDOW ( object ) ;
2008-12-18 07:41:56 -05:00
2011-03-22 15:36:12 -04:00
if ( window - > frame_bounds )
cairo_region_destroy ( window - > frame_bounds ) ;
2013-09-14 08:19:46 -04:00
if ( window - > shape_region )
cairo_region_destroy ( window - > shape_region ) ;
2013-01-14 20:45:31 -05:00
if ( window - > opaque_region )
cairo_region_destroy ( window - > opaque_region ) ;
2014-07-28 05:20:19 -04:00
if ( window - > input_region )
cairo_region_destroy ( window - > input_region ) ;
2013-09-16 08:44:37 -04:00
if ( window - > transient_for )
g_object_unref ( window - > transient_for ) ;
2021-08-05 10:35:18 -04:00
if ( window - > cgroup_path )
g_object_unref ( window - > cgroup_path ) ;
2008-11-07 04:57:00 -05:00
g_free ( window - > sm_client_id ) ;
g_free ( window - > wm_client_machine ) ;
g_free ( window - > startup_id ) ;
g_free ( window - > role ) ;
g_free ( window - > res_class ) ;
g_free ( window - > res_name ) ;
g_free ( window - > title ) ;
g_free ( window - > desc ) ;
2017-09-26 17:22:43 -04:00
g_free ( window - > sandboxed_app_id ) ;
2011-03-19 05:31:25 -04:00
g_free ( window - > gtk_theme_variant ) ;
2012-01-17 13:27:10 -05:00
g_free ( window - > gtk_application_id ) ;
g_free ( window - > gtk_unique_bus_name ) ;
g_free ( window - > gtk_application_object_path ) ;
g_free ( window - > gtk_window_object_path ) ;
g_free ( window - > gtk_app_menu_object_path ) ;
g_free ( window - > gtk_menubar_object_path ) ;
2020-02-13 16:40:15 -05:00
g_free ( window - > placement . rule ) ;
2013-04-23 08:47:19 -04:00
G_OBJECT_CLASS ( meta_window_parent_class ) - > finalize ( object ) ;
2008-11-07 04:57:00 -05:00
}
2008-12-05 20:03:27 -05:00
static void
meta_window_get_property ( GObject * object ,
guint prop_id ,
GValue * value ,
GParamSpec * pspec )
{
MetaWindow * win = META_WINDOW ( object ) ;
switch ( prop_id )
{
case PROP_TITLE :
g_value_set_string ( value , win - > title ) ;
break ;
case PROP_ICON :
2022-01-28 18:02:24 -05:00
g_value_set_pointer ( value , meta_window_get_icon ( win ) ) ;
2008-12-05 20:03:27 -05:00
break ;
case PROP_MINI_ICON :
2022-01-28 18:02:24 -05:00
g_value_set_pointer ( value , meta_window_get_mini_icon ( win ) ) ;
2008-12-18 07:41:56 -05:00
break ;
2009-02-11 07:16:41 -05:00
case PROP_DECORATED :
g_value_set_boolean ( value , win - > decorated ) ;
break ;
2009-03-17 08:27:13 -04:00
case PROP_FULLSCREEN :
g_value_set_boolean ( value , win - > fullscreen ) ;
break ;
2010-02-12 15:26:52 -05:00
case PROP_MAXIMIZED_HORIZONTALLY :
g_value_set_boolean ( value , win - > maximized_horizontally ) ;
break ;
case PROP_MAXIMIZED_VERTICALLY :
g_value_set_boolean ( value , win - > maximized_vertically ) ;
break ;
2011-05-31 13:52:04 -04:00
case PROP_MINIMIZED :
g_value_set_boolean ( value , win - > minimized ) ;
break ;
2009-08-04 03:06:30 -04:00
case PROP_WINDOW_TYPE :
g_value_set_enum ( value , win - > type ) ;
break ;
2009-08-31 12:06:53 -04:00
case PROP_USER_TIME :
g_value_set_uint ( value , win - > net_wm_user_time ) ;
break ;
2009-11-17 05:02:06 -05:00
case PROP_DEMANDS_ATTENTION :
g_value_set_boolean ( value , win - > wm_state_demands_attention ) ;
break ;
2009-11-20 03:51:19 -05:00
case PROP_URGENT :
2014-03-18 13:53:42 -04:00
g_value_set_boolean ( value , win - > urgent ) ;
2009-11-20 03:51:19 -05:00
break ;
2014-01-30 16:39:54 -05:00
case PROP_SKIP_TASKBAR :
g_value_set_boolean ( value , win - > skip_taskbar ) ;
break ;
2010-01-18 05:12:17 -05:00
case PROP_MUTTER_HINTS :
g_value_set_string ( value , win - > mutter_hints ) ;
break ;
2011-03-24 21:36:47 -04:00
case PROP_APPEARS_FOCUSED :
2019-10-12 14:55:26 -04:00
g_value_set_boolean ( value , win - > appears_focused ) ;
2011-03-24 21:36:47 -04:00
break ;
2011-03-03 04:01:04 -05:00
case PROP_WM_CLASS :
g_value_set_string ( value , win - > res_class ) ;
break ;
2011-07-02 07:08:17 -04:00
case PROP_RESIZEABLE :
g_value_set_boolean ( value , win - > has_resize_func ) ;
break ;
case PROP_ABOVE :
g_value_set_boolean ( value , win - > wm_state_above ) ;
break ;
2012-01-17 13:27:10 -05:00
case PROP_GTK_APPLICATION_ID :
g_value_set_string ( value , win - > gtk_application_id ) ;
2011-11-25 18:42:41 -05:00
break ;
2012-01-17 13:27:10 -05:00
case PROP_GTK_UNIQUE_BUS_NAME :
g_value_set_string ( value , win - > gtk_unique_bus_name ) ;
2011-12-05 12:52:35 -05:00
break ;
2012-01-17 13:27:10 -05:00
case PROP_GTK_APPLICATION_OBJECT_PATH :
g_value_set_string ( value , win - > gtk_application_object_path ) ;
break ;
case PROP_GTK_WINDOW_OBJECT_PATH :
g_value_set_string ( value , win - > gtk_window_object_path ) ;
break ;
case PROP_GTK_APP_MENU_OBJECT_PATH :
g_value_set_string ( value , win - > gtk_app_menu_object_path ) ;
break ;
case PROP_GTK_MENUBAR_OBJECT_PATH :
g_value_set_string ( value , win - > gtk_menubar_object_path ) ;
2011-12-05 12:52:35 -05:00
break ;
2014-06-24 16:05:36 -04:00
case PROP_ON_ALL_WORKSPACES :
g_value_set_boolean ( value , win - > on_all_workspaces ) ;
break ;
2022-05-16 10:48:01 -04:00
case PROP_DISPLAY :
g_value_set_object ( value , win - > display ) ;
break ;
case PROP_EFFECT :
g_value_set_int ( value , win - > pending_compositor_effect ) ;
break ;
case PROP_XWINDOW :
g_value_set_ulong ( value , win - > xwindow ) ;
break ;
2008-12-05 20:03:27 -05:00
default :
G_OBJECT_WARN_INVALID_PROPERTY_ID ( object , prop_id , pspec ) ;
2008-12-18 07:41:56 -05:00
break ;
2008-12-05 20:03:27 -05:00
}
}
static void
meta_window_set_property ( GObject * object ,
guint prop_id ,
const GValue * value ,
GParamSpec * pspec )
{
2022-05-16 10:48:01 -04:00
MetaWindow * win = META_WINDOW ( object ) ;
2008-12-05 20:03:27 -05:00
switch ( prop_id )
{
2022-05-16 10:48:01 -04:00
case PROP_DISPLAY :
win - > display = g_value_get_object ( value ) ;
break ;
case PROP_EFFECT :
win - > pending_compositor_effect = g_value_get_int ( value ) ;
break ;
case PROP_XWINDOW :
win - > xwindow = g_value_get_ulong ( value ) ;
break ;
2008-12-05 20:03:27 -05:00
default :
G_OBJECT_WARN_INVALID_PROPERTY_ID ( object , prop_id , pspec ) ;
2008-12-18 07:41:56 -05:00
break ;
2008-12-05 20:03:27 -05:00
}
}
2008-11-07 04:57:00 -05:00
static void
meta_window_class_init ( MetaWindowClass * klass )
{
GObjectClass * object_class = G_OBJECT_CLASS ( klass ) ;
2022-05-16 10:48:01 -04:00
object_class - > constructed = meta_window_constructed ;
2008-11-07 04:57:00 -05:00
object_class - > finalize = meta_window_finalize ;
2008-12-18 07:41:56 -05:00
2008-12-05 20:03:27 -05:00
object_class - > get_property = meta_window_get_property ;
object_class - > set_property = meta_window_set_property ;
2008-12-18 07:41:56 -05:00
2014-04-29 15:55:55 -04:00
klass - > grab_op_began = meta_window_real_grab_op_began ;
klass - > grab_op_ended = meta_window_real_grab_op_ended ;
2014-05-20 15:46:21 -04:00
klass - > current_workspace_changed = meta_window_real_current_workspace_changed ;
2014-04-28 17:06:38 -04:00
klass - > update_struts = meta_window_real_update_struts ;
2014-03-18 11:20:22 -04:00
klass - > get_default_skip_hints = meta_window_real_get_default_skip_hints ;
2016-10-07 11:55:32 -04:00
klass - > get_client_pid = meta_window_real_get_client_pid ;
2014-03-18 11:20:22 -04:00
2014-06-24 16:18:26 -04:00
obj_props [ PROP_TITLE ] =
g_param_spec_string ( " title " ,
" Title " ,
" The title of the window " ,
NULL ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_ICON ] =
2015-01-12 15:23:42 -05:00
g_param_spec_pointer ( " icon " ,
" Icon " ,
2018-03-01 11:08:41 -05:00
" Normal icon, usually 96x96 pixels " ,
2015-01-12 15:23:42 -05:00
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
2014-06-24 16:18:26 -04:00
obj_props [ PROP_MINI_ICON ] =
2015-01-12 15:23:42 -05:00
g_param_spec_pointer ( " mini-icon " ,
" Mini Icon " ,
2018-03-01 11:08:41 -05:00
" Mini icon, usually 16x16 pixels " ,
2015-01-12 15:23:42 -05:00
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
2014-06-24 16:18:26 -04:00
obj_props [ PROP_DECORATED ] =
g_param_spec_boolean ( " decorated " ,
" Decorated " ,
" Whether window is decorated " ,
TRUE ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_FULLSCREEN ] =
g_param_spec_boolean ( " fullscreen " ,
" Fullscreen " ,
" Whether window is fullscreened " ,
FALSE ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_MAXIMIZED_HORIZONTALLY ] =
g_param_spec_boolean ( " maximized-horizontally " ,
" Maximized horizontally " ,
" Whether window is maximized horizontally " ,
FALSE ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_MAXIMIZED_VERTICALLY ] =
g_param_spec_boolean ( " maximized-vertically " ,
" Maximizing vertically " ,
" Whether window is maximized vertically " ,
FALSE ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_MINIMIZED ] =
g_param_spec_boolean ( " minimized " ,
" Minimizing " ,
" Whether window is minimized " ,
FALSE ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_WINDOW_TYPE ] =
g_param_spec_enum ( " window-type " ,
" Window Type " ,
" The type of the window " ,
META_TYPE_WINDOW_TYPE ,
META_WINDOW_NORMAL ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_USER_TIME ] =
g_param_spec_uint ( " user-time " ,
" User time " ,
" Timestamp of last user interaction " ,
0 ,
G_MAXUINT ,
0 ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_DEMANDS_ATTENTION ] =
g_param_spec_boolean ( " demands-attention " ,
" Demands Attention " ,
" Whether the window has _NET_WM_STATE_DEMANDS_ATTENTION set " ,
FALSE ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_URGENT ] =
g_param_spec_boolean ( " urgent " ,
" Urgent " ,
" Whether the urgent flag of WM_HINTS is set " ,
FALSE ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_SKIP_TASKBAR ] =
g_param_spec_boolean ( " skip-taskbar " ,
" Skip taskbar " ,
" Whether the skip-taskbar flag of WM_HINTS is set " ,
FALSE ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_MUTTER_HINTS ] =
g_param_spec_string ( " mutter-hints " ,
" _MUTTER_HINTS " ,
" Contents of the _MUTTER_HINTS property of this window " ,
NULL ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_APPEARS_FOCUSED ] =
g_param_spec_boolean ( " appears-focused " ,
" Appears focused " ,
" Whether the window is drawn as being focused " ,
FALSE ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_RESIZEABLE ] =
g_param_spec_boolean ( " resizeable " ,
" Resizeable " ,
" Whether the window can be resized " ,
FALSE ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_ABOVE ] =
g_param_spec_boolean ( " above " ,
" Above " ,
" Whether the window is shown as always-on-top " ,
FALSE ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_WM_CLASS ] =
g_param_spec_string ( " wm-class " ,
" WM_CLASS " ,
" Contents of the WM_CLASS property of this window " ,
NULL ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_GTK_APPLICATION_ID ] =
g_param_spec_string ( " gtk-application-id " ,
" _GTK_APPLICATION_ID " ,
" Contents of the _GTK_APPLICATION_ID property of this window " ,
NULL ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_GTK_UNIQUE_BUS_NAME ] =
g_param_spec_string ( " gtk-unique-bus-name " ,
" _GTK_UNIQUE_BUS_NAME " ,
" Contents of the _GTK_UNIQUE_BUS_NAME property of this window " ,
NULL ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_GTK_APPLICATION_OBJECT_PATH ] =
g_param_spec_string ( " gtk-application-object-path " ,
" _GTK_APPLICATION_OBJECT_PATH " ,
" Contents of the _GTK_APPLICATION_OBJECT_PATH property of this window " ,
NULL ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_GTK_WINDOW_OBJECT_PATH ] =
g_param_spec_string ( " gtk-window-object-path " ,
" _GTK_WINDOW_OBJECT_PATH " ,
" Contents of the _GTK_WINDOW_OBJECT_PATH property of this window " ,
NULL ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_GTK_APP_MENU_OBJECT_PATH ] =
g_param_spec_string ( " gtk-app-menu-object-path " ,
" _GTK_APP_MENU_OBJECT_PATH " ,
" Contents of the _GTK_APP_MENU_OBJECT_PATH property of this window " ,
NULL ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_GTK_MENUBAR_OBJECT_PATH ] =
g_param_spec_string ( " gtk-menubar-object-path " ,
" _GTK_MENUBAR_OBJECT_PATH " ,
" Contents of the _GTK_MENUBAR_OBJECT_PATH property of this window " ,
NULL ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
obj_props [ PROP_ON_ALL_WORKSPACES ] =
g_param_spec_boolean ( " on-all-workspaces " ,
" On all workspaces " ,
" Whether the window is set to appear on all workspaces " ,
FALSE ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
2021-09-03 17:38:12 -04:00
obj_props [ PROP_IS_ALIVE ] =
g_param_spec_boolean ( " is-alive " ,
" Is alive " ,
" Whether the window responds to pings " ,
TRUE ,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS ) ;
2022-05-16 10:48:01 -04:00
obj_props [ PROP_DISPLAY ] =
g_param_spec_object ( " display " ,
" Display " ,
" The display the window is attached to " ,
META_TYPE_DISPLAY ,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE ) ;
obj_props [ PROP_EFFECT ] =
g_param_spec_int ( " effect " ,
" Compositor effect " ,
" The compositor effect " ,
META_COMP_EFFECT_CREATE ,
META_COMP_EFFECT_NONE ,
META_COMP_EFFECT_NONE ,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE ) ;
obj_props [ PROP_XWINDOW ] =
g_param_spec_ulong ( " xwindow " ,
" X Window " ,
" The corresponding X Window " ,
0 , G_MAXULONG , 0 ,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE ) ;
2018-02-10 07:36:48 -05:00
g_object_class_install_properties ( object_class , PROP_LAST , obj_props ) ;
2014-06-24 16:05:36 -04:00
2009-01-20 07:52:06 -05:00
window_signals [ WORKSPACE_CHANGED ] =
g_signal_new ( " workspace-changed " ,
G_TYPE_FROM_CLASS ( object_class ) ,
G_SIGNAL_RUN_LAST ,
2014-03-18 11:21:02 -04:00
0 ,
2011-10-18 18:06:14 -04:00
NULL , NULL , NULL ,
2014-08-16 13:22:05 -04:00
G_TYPE_NONE , 0 ) ;
2009-02-02 06:00:13 -05:00
window_signals [ FOCUS ] =
g_signal_new ( " focus " ,
G_TYPE_FROM_CLASS ( object_class ) ,
G_SIGNAL_RUN_LAST ,
2014-03-18 11:21:02 -04:00
0 ,
2011-10-18 18:06:14 -04:00
NULL , NULL , NULL ,
2009-02-02 06:00:13 -05:00
G_TYPE_NONE , 0 ) ;
2009-02-02 09:08:46 -05:00
window_signals [ RAISED ] =
g_signal_new ( " raised " ,
G_TYPE_FROM_CLASS ( object_class ) ,
G_SIGNAL_RUN_LAST ,
2014-03-18 11:21:02 -04:00
0 ,
2011-10-18 18:06:14 -04:00
NULL , NULL , NULL ,
2009-02-02 09:08:46 -05:00
G_TYPE_NONE , 0 ) ;
2009-10-13 10:34:34 -04:00
wayland: Move MetaWindow ownership to window owning roles
There are two surface roles owning a MetaWindow: MetaWaylandShellSurface
(basis of MetaWaylandXdgToplevel, MetaWaylandXdgPopup,
MetaWaylandWlShellSurface, etc), and MetaXwaylandSurface.
With these two role types, the MetaWindow has two different types of
life times. With MetaWaylandShellSurface, the window is owned and
managed by the role itself, while with MetaXwaylandSurface, the
MetaWindow is tied to the X11 window, while the Wayland surface and its
role plays more the role of the backing rendering surface.
Before, for historical reasons, MetaWindow was part of
MetaWaylandSurface, even though just some roles used it, and before
'wayland: Untie MetaWindowXwayland lifetime from the wl_surface' had
equivalent life times as well. But since that commit, the management
changed. To not have the same fied in MetaWaylandSurface being managed
in such drastically different ways, rearrange it so that the roles that
has a MetaWindow themself manages it in the way it is meant to; meaning
MetaWaylandShellSurface practically owns it, while with Xwayland, the
existance of a MetaWindow is tracked via X11.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
2019-10-09 03:57:40 -04:00
window_signals [ UNMANAGING ] =
g_signal_new ( " unmanaging " ,
G_TYPE_FROM_CLASS ( object_class ) ,
G_SIGNAL_RUN_LAST ,
0 ,
NULL , NULL , NULL ,
G_TYPE_NONE , 0 ) ;
2009-10-13 10:34:34 -04:00
window_signals [ UNMANAGED ] =
g_signal_new ( " unmanaged " ,
G_TYPE_FROM_CLASS ( object_class ) ,
G_SIGNAL_RUN_LAST ,
2014-03-18 11:21:02 -04:00
0 ,
2011-10-18 18:06:14 -04:00
NULL , NULL , NULL ,
2009-10-13 10:34:34 -04:00
G_TYPE_NONE , 0 ) ;
2013-12-06 15:39:24 -05:00
/**
* MetaWindow : : position - changed :
* @ window : a # MetaWindow
*
* This is emitted when the position of a window might
* have changed . Specifically , this is emitted when the
* position of the toplevel window has changed , or when
* the position of the client window has changed .
*/
window_signals [ POSITION_CHANGED ] =
g_signal_new ( " position-changed " ,
G_TYPE_FROM_CLASS ( object_class ) ,
G_SIGNAL_RUN_LAST ,
0 ,
NULL , NULL , NULL ,
G_TYPE_NONE , 0 ) ;
2018-07-12 04:25:16 -04:00
/**
* MetaWindow : : shown :
* @ window : a # MetaWindow
*
* This is emitted after a window has been shown .
*/
window_signals [ SHOWN ] =
g_signal_new ( " shown " ,
G_TYPE_FROM_CLASS ( object_class ) ,
G_SIGNAL_RUN_LAST ,
0 ,
NULL , NULL , NULL ,
G_TYPE_NONE , 0 ) ;
2013-12-06 15:39:24 -05:00
/**
* MetaWindow : : size - changed :
* @ window : a # MetaWindow
*
2019-05-07 05:42:13 -04:00
* This is emitted when the size of a window might
2013-12-06 15:39:24 -05:00
* have changed . Specifically , this is emitted when the
* size of the toplevel window has changed , or when the
* size of the client window has changed .
*/
window_signals [ SIZE_CHANGED ] =
g_signal_new ( " size-changed " ,
G_TYPE_FROM_CLASS ( object_class ) ,
G_SIGNAL_RUN_LAST ,
0 ,
NULL , NULL , NULL ,
G_TYPE_NONE , 0 ) ;
2008-11-07 04:57:00 -05:00
}
static void
meta_window_init ( MetaWindow * self )
{
2014-09-08 21:20:14 -04:00
self - > stamp = next_window_stamp + + ;
2011-11-25 19:52:24 -05:00
meta_prefs_add_listener ( prefs_changed_callback , self ) ;
2021-09-03 17:38:12 -04:00
self - > is_alive = TRUE ;
2008-11-07 04:57:00 -05:00
}
2003-05-16 17:59:08 -04:00
static gboolean
is_desktop_or_dock_foreach ( MetaWindow * window ,
void * data )
{
gboolean * result = data ;
* result =
window - > type = = META_WINDOW_DESKTOP | |
wayland: Add API to launch trusted clients
Allowing code from inside mutter to create a child process and
delegate on it some of its tasks is something very useful. This can
be done easily with the g_subprocess and g_subprocess_launcher classes
already available in GLib and GObject.
Unfortunately, although the child process can be a graphical program,
currently it is not possible for the inner code to identify the
windows created by the child in a secure manner (this is: being able
to ensure that a malicious program won't be able to trick the inner
code into thinking it is a child process launched by it).
Under X11 this is not a problem because any program has full control
over their windows, but under Wayland it is a different story: a
program can't neither force their window to be kept at the top (like a
docker program does) or at the bottom (like a program for desktop icons
does), nor hide it from the list of windows. This means that it is not
possible for a "classic", non-priviledged program, to fulfill these
tasks, and it can be done only from code inside mutter (like a
gnome-shell extension).
This is a non desirable situation, because an extension runs in the
same main loop than the whole desktop itself, which means that a
complex extension can need to do too much work inside the main loop,
and freeze the whole desktop for too much time. Also, it is important
to note that javascript doesn't have access to fork(), or threads,
which means that, at most, all the parallel computing that can do is
those available in the _async calls in GLib/GObject.
Also, having to create an extension for any priviledged graphical
element is an stopper for a lot of programmers who already know
GTK+ but doesn't know Clutter.
This patch wants to offer a solution to this problem, by offering a
new class that allows to launch a trusted child process from inside
mutter, and make it to use an specific UNIX socket to communicate
with the compositor. It also allows to check whether an specific
MetaWindow was created by one of this trusted child processes or not.
This allows to create extensions that launch a child process, and
when that process creates a window, the extension can confirm in a
secure way that the window really belongs to that process
launched by it, so it can give to that window "superpowers" like
being kept at the bottom of the desktop, not being listed in the
list of windows or shown in the Activities panel... Also, in future
versions, it could easily implement protocol extensions that only
could be used by these trusted child processes.
Several examples of the usefulness of this are that, with it, it
is possible to write programs that implements:
- desktop icons
- a dock
- a top or bottom bar
...
all in a secure manner, avoiding insecure programs to do the same.
In fact, even if the same code is launched manually, it won't have
those privileges, only the specific process launched from inside
mutter.
Since this is only needed under Wayland, it won't work under X11.
Fixes https://gitlab.gnome.org/GNOME/mutter/issues/741
2020-08-04 04:42:29 -04:00
window - > type = = META_WINDOW_DOCK | |
window - > skip_from_window_list ;
2003-05-16 17:59:08 -04:00
if ( * result )
return FALSE ; /* stop as soon as we find one */
else
return TRUE ;
}
/* window is the window that's newly mapped provoking
* the possible change
*/
static void
maybe_leave_show_desktop_mode ( MetaWindow * window )
{
2017-08-27 15:02:40 -04:00
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
2003-05-16 17:59:08 -04:00
gboolean is_desktop_or_dock ;
2017-08-27 15:02:40 -04:00
if ( ! workspace_manager - > active_workspace - > showing_desktop )
2003-05-16 17:59:08 -04:00
return ;
/* If the window is a transient for the dock or desktop, don't
* leave show desktop mode when the window opens . That ' s
* so you can e . g . hide all windows , manipulate a file on
* the desktop via a dialog , then unshow windows again .
*/
is_desktop_or_dock = FALSE ;
2003-05-18 13:16:03 -04:00
is_desktop_or_dock_foreach ( window ,
& is_desktop_or_dock ) ;
2003-05-16 17:59:08 -04:00
meta_window_foreach_ancestor ( window , is_desktop_or_dock_foreach ,
& is_desktop_or_dock ) ;
if ( ! is_desktop_or_dock )
{
2017-08-27 15:02:40 -04:00
meta_workspace_manager_minimize_all_on_active_workspace_except ( workspace_manager ,
window ) ;
meta_workspace_manager_unshow_desktop ( workspace_manager ) ;
2003-05-16 17:59:08 -04:00
}
}
window: make determination of attached dialog windows more consistent
Different bits of code were using slightly different checks to test
whether a window was an attached dialog. Add a new
meta_window_is_attached_dialog(), and use that everywhere.
Also, freeze the is-attached status when the window is first shown,
rather than recomputing it each time the caller asks, since this could
cause problems if a window changes its type after it has already been
attached, etc. However, if an attached window's parent is destroyed,
or an attached window changes its transient-for, then fix things up by
destroying the old MetaWindow and creating a new one (causing
compositor unmap and map events to be fired off, allowing the display
of the window to be fixed up).
Remove some code in display.c that tried to fix existing windows if
the gconf setting changed, but which didn't actually do anything (at
least under gnome-shell). However, if 654643 was fixed then the new
behavior with this patch would be that changing the gconf setting
would affect new dialogs, but not existing ones.
https://bugzilla.gnome.org/show_bug.cgi?id=646761
2011-04-05 10:14:52 -04:00
gboolean
meta_window_should_attach_to_parent ( MetaWindow * window )
{
MetaWindow * parent ;
if ( ! meta_prefs_get_attach_modal_dialogs ( ) | |
window - > type ! = META_WINDOW_MODAL_DIALOG )
return FALSE ;
parent = meta_window_get_transient_for ( window ) ;
if ( ! parent )
return FALSE ;
2011-07-22 12:34:10 -04:00
switch ( parent - > type )
{
case META_WINDOW_NORMAL :
case META_WINDOW_DIALOG :
case META_WINDOW_MODAL_DIALOG :
return TRUE ;
default :
return FALSE ;
}
window: make determination of attached dialog windows more consistent
Different bits of code were using slightly different checks to test
whether a window was an attached dialog. Add a new
meta_window_is_attached_dialog(), and use that everywhere.
Also, freeze the is-attached status when the window is first shown,
rather than recomputing it each time the caller asks, since this could
cause problems if a window changes its type after it has already been
attached, etc. However, if an attached window's parent is destroyed,
or an attached window changes its transient-for, then fix things up by
destroying the old MetaWindow and creating a new one (causing
compositor unmap and map events to be fired off, allowing the display
of the window to be fixed up).
Remove some code in display.c that tried to fix existing windows if
the gconf setting changed, but which didn't actually do anything (at
least under gnome-shell). However, if 654643 was fixed then the new
behavior with this patch would be that changing the gconf setting
would affect new dialogs, but not existing ones.
https://bugzilla.gnome.org/show_bug.cgi?id=646761
2011-04-05 10:14:52 -04:00
}
Always map the client and frame windows
Traditionally, WMs unmap windows when minimizing them, and map them
when restoring them or wanting to show them for other reasons, like
upon creation.
However, as metacity morphed into mutter, we optionally chose to keep
windows mapped for the lifetime of the window under the user option
"live-window-previews", which makes the code keep windows mapped so it
can show window preview for minimized windows in other places, like
Alt-Tab and Expose.
I removed this preference two years ago mechanically, by removing all
the if statements, but never went through and cleaned up the code so
that windows are simply mapped for the lifetime of the window -- the
"architecture" of the old code that maps and unmaps on show/hide was
still there.
Remove this now.
The one case we still need to be careful of is shaded windows, in which
we do still unmap the client window. In the future, we might want to
show previews of shaded windows in the overview and Alt-Tab. In that
we'd also keep shaded windows mapped, and could remove all unmap logic,
but we'd need a more complex method of showing the shaded titlebar, such
as using a different actor.
At the same time, simplify the compositor interface by removing
meta_compositor_window_[un]mapped API, and instead adding/removing the
window on-demand.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 19:06:51 -05:00
static gboolean
client_window_should_be_mapped ( MetaWindow * window )
{
2015-06-17 06:37:20 -04:00
# ifdef HAVE_WAYLAND
2022-05-18 07:51:44 -04:00
if ( window - > client_type = = META_WINDOW_CLIENT_TYPE_WAYLAND )
{
MetaWaylandSurface * surface = meta_window_get_wayland_surface ( window ) ;
if ( ! meta_wayland_surface_get_buffer ( surface ) )
return FALSE ;
}
2015-06-17 06:37:20 -04:00
# endif
2015-06-08 05:55:54 -04:00
x11: Integrate frames client into Mutter
Replace the in-process implementation of frames with the external
frames client.
When a client window is created and managed by Mutter, Mutter will
determine whether it is a window that requires decorations and
hint the creation of a frame for it by setting the _MUTTER_NEEDS_FRAME
property on the client window.
After the frames client created a window that has the _MUTTER_FRAME_FOR
property, Mutter will proceed to reparent the client window on the
frame window, and show them as a single unit.
Rendering and event handling on the frame window will be performed by
the external client, Mutter is still responsible for everything else,
namely resizing client and frame window in synchronization, and
managing updates on the MetaWindowActor.
In order to let the frame be managed by the external client, Mutter
needs to change the way some properties are forwarded to the client
and/or frame windows. Some properties are necessary to keep propagating
to the client window only, some others need to happen on the frame
window now, and some others needs to be propagated on both so they
are synchronized about the behavior.
Also, some events that were previously totally unexpected in frame
windows are now susceptible to happen, so must be allowed now.
MetaFrame in src/core/frame.c now acts as the wrapper of foreign
windows created by the frames client, from the Mutter side. Location,
size, and lifetime are still largely in control of Mutter, some
details like visible/invisible borders are obtained from the client
instead (through the _MUTTER_FRAME_EXTENTS and _GTK_FRAME_EXTENTS
properties, respectively).
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2175>
2022-09-08 04:35:47 -04:00
if ( window - > client_type = = META_WINDOW_CLIENT_TYPE_X11 & &
window - > decorated & & ! window - > frame )
return FALSE ;
Always map the client and frame windows
Traditionally, WMs unmap windows when minimizing them, and map them
when restoring them or wanting to show them for other reasons, like
upon creation.
However, as metacity morphed into mutter, we optionally chose to keep
windows mapped for the lifetime of the window under the user option
"live-window-previews", which makes the code keep windows mapped so it
can show window preview for minimized windows in other places, like
Alt-Tab and Expose.
I removed this preference two years ago mechanically, by removing all
the if statements, but never went through and cleaned up the code so
that windows are simply mapped for the lifetime of the window -- the
"architecture" of the old code that maps and unmaps on show/hide was
still there.
Remove this now.
The one case we still need to be careful of is shaded windows, in which
we do still unmap the client window. In the future, we might want to
show previews of shaded windows in the overview and Alt-Tab. In that
we'd also keep shaded windows mapped, and could remove all unmap logic,
but we'd need a more complex method of showing the shaded titlebar, such
as using a different actor.
At the same time, simplify the compositor interface by removing
meta_compositor_window_[un]mapped API, and instead adding/removing the
window on-demand.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 19:06:51 -05:00
return ! window - > shaded ;
}
static void
sync_client_window_mapped ( MetaWindow * window )
{
gboolean should_be_mapped = client_window_should_be_mapped ( window ) ;
window: Don't try to map / unmap OR windows by ourselves
This is bad behavior, and can also cause us to get in an infinite loop
if an OR window is mapped and unmapped in quick succession. This
sequence causes a MapNotify followed by an UnmapNotify, and when
processing the events, we'll call XMapWindow, XUnmapWindow, which will
put another set of MapNotify, UnmapNotify events in our queue, which we
then process by calling XMapWindow, XUnmapWindow, and so it goes
forever, or at least some scheduler uncorks us by making us call
XMapWindow when the window is already mapped, or XUnmapWindow when the
window is already unmapped.
We can stop this madness by simply making sure never to call neither
XMapWindow or XUnmapWindow on OR windows, which is the correct thing to
do anyway.
2014-08-19 15:57:52 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
Always map the client and frame windows
Traditionally, WMs unmap windows when minimizing them, and map them
when restoring them or wanting to show them for other reasons, like
upon creation.
However, as metacity morphed into mutter, we optionally chose to keep
windows mapped for the lifetime of the window under the user option
"live-window-previews", which makes the code keep windows mapped so it
can show window preview for minimized windows in other places, like
Alt-Tab and Expose.
I removed this preference two years ago mechanically, by removing all
the if statements, but never went through and cleaned up the code so
that windows are simply mapped for the lifetime of the window -- the
"architecture" of the old code that maps and unmaps on show/hide was
still there.
Remove this now.
The one case we still need to be careful of is shaded windows, in which
we do still unmap the client window. In the future, we might want to
show previews of shaded windows in the overview and Alt-Tab. In that
we'd also keep shaded windows mapped, and could remove all unmap logic,
but we'd need a more complex method of showing the shaded titlebar, such
as using a different actor.
At the same time, simplify the compositor interface by removing
meta_compositor_window_[un]mapped API, and instead adding/removing the
window on-demand.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 19:06:51 -05:00
if ( window - > mapped = = should_be_mapped )
return ;
window - > mapped = should_be_mapped ;
2018-12-30 07:55:52 -05:00
if ( window - > mapped )
META_WINDOW_GET_CLASS ( window ) - > map ( window ) ;
Always map the client and frame windows
Traditionally, WMs unmap windows when minimizing them, and map them
when restoring them or wanting to show them for other reasons, like
upon creation.
However, as metacity morphed into mutter, we optionally chose to keep
windows mapped for the lifetime of the window under the user option
"live-window-previews", which makes the code keep windows mapped so it
can show window preview for minimized windows in other places, like
Alt-Tab and Expose.
I removed this preference two years ago mechanically, by removing all
the if statements, but never went through and cleaned up the code so
that windows are simply mapped for the lifetime of the window -- the
"architecture" of the old code that maps and unmaps on show/hide was
still there.
Remove this now.
The one case we still need to be careful of is shaded windows, in which
we do still unmap the client window. In the future, we might want to
show previews of shaded windows in the overview and Alt-Tab. In that
we'd also keep shaded windows mapped, and could remove all unmap logic,
but we'd need a more complex method of showing the shaded titlebar, such
as using a different actor.
At the same time, simplify the compositor interface by removing
meta_compositor_window_[un]mapped API, and instead adding/removing the
window on-demand.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 19:06:51 -05:00
else
2018-12-30 07:55:52 -05:00
META_WINDOW_GET_CLASS ( window ) - > unmap ( window ) ;
Always map the client and frame windows
Traditionally, WMs unmap windows when minimizing them, and map them
when restoring them or wanting to show them for other reasons, like
upon creation.
However, as metacity morphed into mutter, we optionally chose to keep
windows mapped for the lifetime of the window under the user option
"live-window-previews", which makes the code keep windows mapped so it
can show window preview for minimized windows in other places, like
Alt-Tab and Expose.
I removed this preference two years ago mechanically, by removing all
the if statements, but never went through and cleaned up the code so
that windows are simply mapped for the lifetime of the window -- the
"architecture" of the old code that maps and unmaps on show/hide was
still there.
Remove this now.
The one case we still need to be careful of is shaded windows, in which
we do still unmap the client window. In the future, we might want to
show previews of shaded windows in the overview and Alt-Tab. In that
we'd also keep shaded windows mapped, and could remove all unmap logic,
but we'd need a more complex method of showing the shaded titlebar, such
as using a different actor.
At the same time, simplify the compositor interface by removing
meta_compositor_window_[un]mapped API, and instead adding/removing the
window on-demand.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 19:06:51 -05:00
}
2017-09-26 17:22:43 -04:00
static gboolean
meta_window_update_flatpak_id ( MetaWindow * window ,
uint32_t pid )
2016-10-07 11:55:32 -04:00
{
g_autoptr ( GKeyFile ) key_file = NULL ;
g_autofree char * info_filename = NULL ;
2017-09-26 17:22:43 -04:00
g_return_val_if_fail ( pid ! = 0 , FALSE ) ;
g_return_val_if_fail ( window - > sandboxed_app_id = = NULL , FALSE ) ;
2016-10-07 11:55:32 -04:00
key_file = g_key_file_new ( ) ;
info_filename = g_strdup_printf ( " /proc/%u/root/.flatpak-info " , pid ) ;
if ( ! g_key_file_load_from_file ( key_file , info_filename , G_KEY_FILE_NONE , NULL ) )
2017-09-26 17:22:43 -04:00
return FALSE ;
window - > sandboxed_app_id = g_key_file_get_string ( key_file , " Application " , " name " , NULL ) ;
return TRUE ;
}
static gboolean
meta_window_update_snap_id ( MetaWindow * window ,
uint32_t pid )
{
g_autofree char * security_label_filename = NULL ;
g_autofree char * security_label_contents = NULL ;
gsize i , security_label_contents_size = 0 ;
char * contents_start ;
char * contents_end ;
char * sandboxed_app_id ;
g_return_val_if_fail ( pid ! = 0 , FALSE ) ;
g_return_val_if_fail ( window - > sandboxed_app_id = = NULL , FALSE ) ;
security_label_filename = g_strdup_printf ( " /proc/%u/attr/current " , pid ) ;
if ( ! g_file_get_contents ( security_label_filename ,
& security_label_contents ,
& security_label_contents_size ,
NULL ) )
return FALSE ;
if ( ! g_str_has_prefix ( security_label_contents , SNAP_SECURITY_LABEL_PREFIX ) )
return FALSE ;
/* We need to translate the security profile into the desktop-id.
* The profile is in the form of ' snap . name - space . binary - name ( current ) '
* while the desktop id will be name - space_binary - name .
*/
security_label_contents_size - = sizeof ( SNAP_SECURITY_LABEL_PREFIX ) - 1 ;
contents_start = security_label_contents + sizeof ( SNAP_SECURITY_LABEL_PREFIX ) - 1 ;
contents_end = strchr ( contents_start , ' ' ) ;
if ( contents_end )
security_label_contents_size = contents_end - contents_start ;
for ( i = 0 ; i < security_label_contents_size ; + + i )
{
if ( contents_start [ i ] = = ' . ' )
contents_start [ i ] = ' _ ' ;
}
sandboxed_app_id = g_malloc0 ( security_label_contents_size + 1 ) ;
memcpy ( sandboxed_app_id , contents_start , security_label_contents_size ) ;
window - > sandboxed_app_id = sandboxed_app_id ;
return TRUE ;
}
static void
meta_window_update_sandboxed_app_id ( MetaWindow * window )
{
2020-04-08 10:17:09 -04:00
pid_t pid ;
2017-09-26 17:22:43 -04:00
g_clear_pointer ( & window - > sandboxed_app_id , g_free ) ;
2020-04-06 07:03:49 -04:00
pid = meta_window_get_pid ( window ) ;
2017-09-26 17:22:43 -04:00
2020-04-08 10:17:09 -04:00
if ( pid < 1 )
2016-10-07 11:55:32 -04:00
return ;
2017-09-26 17:22:43 -04:00
if ( meta_window_update_flatpak_id ( window , pid ) )
return ;
if ( meta_window_update_snap_id ( window , pid ) )
return ;
2016-10-07 11:55:32 -04:00
}
2014-03-18 21:19:51 -04:00
static void
meta_window_update_desc ( MetaWindow * window )
{
g_clear_pointer ( & window - > desc , g_free ) ;
2015-10-12 08:04:55 -04:00
if ( window - > client_type = = META_WINDOW_CLIENT_TYPE_X11 )
2018-08-09 20:16:02 -04:00
window - > desc = g_strdup_printf ( " 0x%lx " , window - > xwindow ) ;
2014-03-18 21:19:51 -04:00
else
2015-10-12 08:04:55 -04:00
{
guint64 small_stamp = window - > stamp - G_GUINT64_CONSTANT ( 0x100000000 ) ;
2018-08-09 20:16:02 -04:00
window - > desc = g_strdup_printf ( " W% " G_GUINT64_FORMAT , small_stamp ) ;
2015-10-12 08:04:55 -04:00
}
2014-03-18 21:19:51 -04:00
}
2015-03-02 22:13:05 -05:00
static void
2016-11-25 01:31:38 -05:00
meta_window_main_monitor_changed ( MetaWindow * window ,
const MetaLogicalMonitor * old )
2015-03-02 22:13:05 -05:00
{
META_WINDOW_GET_CLASS ( window ) - > main_monitor_changed ( window , old ) ;
if ( old )
2017-08-26 15:10:38 -04:00
g_signal_emit_by_name ( window - > display , " window-left-monitor " ,
2015-03-02 22:13:05 -05:00
old - > number , window ) ;
if ( window - > monitor )
2017-08-26 15:10:38 -04:00
g_signal_emit_by_name ( window - > display , " window-entered-monitor " ,
2015-03-02 22:13:05 -05:00
window - > monitor - > number , window ) ;
}
2016-12-01 00:01:39 -05:00
MetaLogicalMonitor *
2022-08-03 16:55:56 -04:00
meta_window_find_monitor_from_frame_rect ( MetaWindow * window )
2016-12-01 00:01:39 -05:00
{
2022-05-27 16:27:07 -04:00
MetaBackend * backend = backend_from_window ( window ) ;
2016-12-01 00:01:39 -05:00
MetaMonitorManager * monitor_manager =
meta_backend_get_monitor_manager ( backend ) ;
MetaRectangle window_rect ;
meta_window_get_frame_rect ( window , & window_rect ) ;
return meta_monitor_manager_get_logical_monitor_from_rect ( monitor_manager ,
& window_rect ) ;
}
2019-08-29 13:34:18 -04:00
static void
meta_window_manage ( MetaWindow * window )
{
COGL_TRACE_BEGIN_SCOPED ( MetaWindowManage ,
" Window (manage) " ) ;
META_WINDOW_GET_CLASS ( window ) - > manage ( window ) ;
}
2022-05-16 10:48:01 -04:00
static void
meta_window_constructed ( GObject * object )
2003-11-20 21:32:05 -05:00
{
2022-05-16 10:48:01 -04:00
MetaWindow * window = META_WINDOW ( object ) ;
MetaDisplay * display = window - > display ;
2021-12-17 18:03:21 -05:00
MetaContext * context = meta_display_get_context ( display ) ;
MetaBackend * backend = meta_context_get_backend ( context ) ;
2017-08-27 15:02:40 -04:00
MetaWorkspaceManager * workspace_manager = display - > workspace_manager ;
2019-08-29 13:34:18 -04:00
2022-05-16 10:48:01 -04:00
COGL_TRACE_BEGIN_SCOPED ( MetaWindowSharedInit ,
" Window (init) " ) ;
2001-05-30 11:36:31 -04:00
deleted and moved into window-props.c (meta_window_new_with_attrs): added
2006-03-25 Thomas Thurman <thomas@thurman.org.uk>
* src/window.c, src/window.h (update_net_wm_state,
update_mwm_hints, update_wm_class, update_transient_for):
deleted and moved into window-props.c
(meta_window_new_with_attrs): added constructing field
and four new initial properties (as above)
(meta_window_recalc_features,
meta_window_recalc_window_type): new functions
* src/window-props.c (init_net_wm_state, reload_net_wm_state
init_mwm_hints, reload_mwm_hints, init_wm_class,
reload_mwm_class, init_transient_for, reload_transient_for):
new functions, moved in from window.c
(meta_display_init_window_prop_hooks): initialise new properties
2006-03-25 17:57:22 -05:00
window - > constructing = TRUE ;
2008-12-18 07:41:56 -05:00
2022-05-16 10:48:01 -04:00
meta_display_register_stamp ( display , & window - > stamp , window ) ;
2014-09-08 21:20:14 -04:00
Partially resolve the conflicting requirements of windows on multiple
2004-12-22 Elijah Newren <newren@gmail.com>
Partially resolve the conflicting requirements of windows on
multiple workspaces and hidden being a global quantity for windows
(fixes bug 156182; the remainder of the work is bug 87531 and is a
libwnck issue)
* src/display.c (event_callback):
* src/window.c (meta_window_visible_on_workspace, meta_window_unstick):
* src/workspace.c (meta_workspace_add_window,
meta_workspace_contains_window,
meta_workspace_queue_calc_showing):
* src/workspace.h:
Remove meta_workspace_contains_window, replace with simple
comparison utilizing window->workspace
* src/place.c (meta_window_place):
* src/window.c (meta_window_shares_some_workspace):
* src/window.h:
Remove meta_window_shares_some_workspace, replace with a simple
comparison utilizing window->workspace
* src/session.c (save_state),
* src/window.c (meta_window_new_with_attrs,
meta_window_apply_session_info, meta_window_free,
window_showing_on_its_workspace,
meta_window_change_workspace_without_transients,
meta_window_unstick, meta_window_set_current_workspace_hint,
meta_window_get_workspaces):
* src/window.h:
* src/workspace.c (meta_workspace_free, meta_workspace_add_window,
meta_workspace_remove_window):
Only one workspace now
2004-12-22 18:52:52 -05:00
window - > workspace = NULL ;
2002-12-09 22:23:04 -05:00
2017-09-26 17:22:43 -04:00
meta_window_update_sandboxed_app_id ( window ) ;
2014-03-18 21:19:51 -04:00
meta_window_update_desc ( window ) ;
2003-06-07 13:15:33 -04:00
2001-06-10 23:24:20 -04:00
/* avoid tons of stack updates */
2022-05-16 10:48:01 -04:00
meta_stack_freeze ( display - > stack ) ;
2003-04-26 13:40:32 -04:00
/* initialize the remaining size_hints as if size_hints.flags were zero */
meta_set_normal_hints ( window , NULL ) ;
2001-06-07 01:18:10 -04:00
/* And this is our unmaximized size */
2016-01-10 09:16:09 -05:00
window - > saved_rect = window - > rect ;
2022-01-07 10:30:19 -05:00
window - > saved_rect_fullscreen = window - > rect ;
window: Replace the user_rect with the unconstrained_rect
Realistically, the user rect contains the unconstrained window
rectangle coordinates that we want to be displaying, in case
something in the constraints change.
Rename it to the "unconstrained_rect", and change the code to always
save it, regardless of current state.
When metacity was originally being built, the purpose of the user
rect was a lot less clear. The code only saved it on user actions,
with various other calls to save_user_window_placement() and a force
mechanism sprinkled in to avoid windows being snapped back to odd
places when constraints changed.
This could lead to odd bugs. For instance, if the user uses some
extension which automatically tiles windows and didn't pass
user_action=TRUE, and then the struts changed, the window would be
placed back at the last place a user moved it to, rather than where
the window was tiled to.
The META_IS_USER_ACTION flag is still used in the constraints code
to determine whether we should allow shoving windows offscreen, so
we can't remove it completely, but we should think about splitting
out the constrainment policies it commands for a bit more
fine-grained control.
https://bugzilla.gnome.org/show_bug.cgi?id=726714
2014-03-18 10:53:00 -04:00
window - > unconstrained_rect = window - > rect ;
2008-12-18 07:41:56 -05:00
2001-06-02 00:14:18 -04:00
window - > title = NULL ;
2001-06-02 21:33:27 -04:00
window - > frame = NULL ;
2001-06-04 00:58:22 -04:00
window - > has_focus = FALSE ;
2011-03-24 21:36:47 -04:00
window - > attached_focus_window = NULL ;
2001-06-04 02:17:52 -04:00
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
window - > maximized_horizontally = FALSE ;
window - > maximized_vertically = FALSE ;
window - > maximize_horizontally_after_placement = FALSE ;
window - > maximize_vertically_after_placement = FALSE ;
2006-10-01 17:59:09 -04:00
window - > minimize_after_placement = FALSE ;
2002-02-23 17:58:02 -05:00
window - > fullscreen = FALSE ;
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
window - > require_fully_onscreen = TRUE ;
2009-08-31 09:52:16 -04:00
window - > require_on_single_monitor = TRUE ;
2006-08-07 19:34:55 -04:00
window - > require_titlebar_visible = TRUE ;
2001-06-09 23:17:15 -04:00
window - > on_all_workspaces = FALSE ;
2011-02-28 05:41:23 -05:00
window - > on_all_workspaces_requested = FALSE ;
2016-01-10 09:16:09 -05:00
window - > tile_mode = META_TILE_NONE ;
window - > tile_monitor_number = - 1 ;
2017-09-27 08:37:57 -04:00
window - > tile_hfraction = - 1. ;
2001-06-07 22:17:48 -04:00
window - > shaded = FALSE ;
2001-06-04 02:17:52 -04:00
window - > initially_iconic = FALSE ;
window - > minimized = FALSE ;
2005-10-03 16:02:31 -04:00
window - > tab_unminimized = FALSE ;
2001-06-04 02:17:52 -04:00
window - > iconic = FALSE ;
2014-03-28 13:50:45 -04:00
window - > known_to_compositor = FALSE ;
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
window - > visible_to_compositor = FALSE ;
2004-12-28 01:01:42 -05:00
/* if already mapped, no need to worry about focus-on-first-time-showing */
window - > showing_for_first_time = ! window - > mapped ;
2009-06-15 18:25:07 -04:00
/* if already mapped we don't want to do the placement thing;
* override - redirect windows are placed by the app */
window - > placed = ( ( window - > mapped & & ! window - > hidden ) | | window - > override_redirect ) ;
2005-02-11 14:20:44 -05:00
window - > denied_focus_and_not_transient = FALSE ;
2001-06-21 23:20:21 -04:00
window - > unmanaging = FALSE ;
2001-06-23 01:49:35 -04:00
window - > keys_grabbed = FALSE ;
window - > grab_on_frame = FALSE ;
2001-06-23 14:30:27 -04:00
window - > withdrawn = FALSE ;
2001-06-24 02:47:54 -04:00
window - > initial_workspace_set = FALSE ;
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
window - > initial_timestamp_set = FALSE ;
window - > net_wm_user_time_set = FALSE ;
2007-03-31 01:19:41 -04:00
window - > user_time_window = None ;
2009-11-09 13:47:16 -05:00
window - > input = TRUE ;
2001-06-24 04:09:10 -04:00
window - > calc_placement = FALSE ;
2003-10-13 16:15:40 -04:00
window - > have_focus_click_grab = FALSE ;
2008-12-18 07:41:56 -05:00
2001-06-10 23:24:20 -04:00
window - > unmaps_pending = 0 ;
2019-06-24 09:10:22 -04:00
window - > reparents_pending = 0 ;
2008-12-18 07:41:56 -05:00
2001-06-23 14:30:27 -04:00
window - > mwm_decorated = TRUE ;
2002-06-21 23:23:02 -04:00
window - > mwm_border_only = FALSE ;
2001-06-23 14:30:27 -04:00
window - > mwm_has_close_func = TRUE ;
window - > mwm_has_minimize_func = TRUE ;
window - > mwm_has_maximize_func = TRUE ;
window - > mwm_has_move_func = TRUE ;
window - > mwm_has_resize_func = TRUE ;
2008-12-18 07:41:56 -05:00
2001-06-08 02:39:38 -04:00
window - > has_close_func = TRUE ;
window - > has_minimize_func = TRUE ;
window - > has_maximize_func = TRUE ;
2001-06-23 14:30:27 -04:00
window - > has_move_func = TRUE ;
window - > has_resize_func = TRUE ;
2001-06-23 02:54:28 -04:00
window - > has_shade_func = TRUE ;
2002-02-23 17:58:02 -05:00
window - > has_fullscreen_func = TRUE ;
2003-05-16 17:59:08 -04:00
window - > always_sticky = FALSE ;
2008-12-18 07:41:56 -05:00
2002-07-06 15:05:37 -04:00
window - > skip_taskbar = FALSE ;
window - > skip_pager = FALSE ;
wayland: Add API to launch trusted clients
Allowing code from inside mutter to create a child process and
delegate on it some of its tasks is something very useful. This can
be done easily with the g_subprocess and g_subprocess_launcher classes
already available in GLib and GObject.
Unfortunately, although the child process can be a graphical program,
currently it is not possible for the inner code to identify the
windows created by the child in a secure manner (this is: being able
to ensure that a malicious program won't be able to trick the inner
code into thinking it is a child process launched by it).
Under X11 this is not a problem because any program has full control
over their windows, but under Wayland it is a different story: a
program can't neither force their window to be kept at the top (like a
docker program does) or at the bottom (like a program for desktop icons
does), nor hide it from the list of windows. This means that it is not
possible for a "classic", non-priviledged program, to fulfill these
tasks, and it can be done only from code inside mutter (like a
gnome-shell extension).
This is a non desirable situation, because an extension runs in the
same main loop than the whole desktop itself, which means that a
complex extension can need to do too much work inside the main loop,
and freeze the whole desktop for too much time. Also, it is important
to note that javascript doesn't have access to fork(), or threads,
which means that, at most, all the parallel computing that can do is
those available in the _async calls in GLib/GObject.
Also, having to create an extension for any priviledged graphical
element is an stopper for a lot of programmers who already know
GTK+ but doesn't know Clutter.
This patch wants to offer a solution to this problem, by offering a
new class that allows to launch a trusted child process from inside
mutter, and make it to use an specific UNIX socket to communicate
with the compositor. It also allows to check whether an specific
MetaWindow was created by one of this trusted child processes or not.
This allows to create extensions that launch a child process, and
when that process creates a window, the extension can confirm in a
secure way that the window really belongs to that process
launched by it, so it can give to that window "superpowers" like
being kept at the bottom of the desktop, not being listed in the
list of windows or shown in the Activities panel... Also, in future
versions, it could easily implement protocol extensions that only
could be used by these trusted child processes.
Several examples of the usefulness of this are that, with it, it
is possible to write programs that implements:
- desktop icons
- a dock
- a top or bottom bar
...
all in a secure manner, avoiding insecure programs to do the same.
In fact, even if the same code is launched manually, it won't have
those privileges, only the specific process launched from inside
mutter.
Since this is only needed under Wayland, it won't work under X11.
Fixes https://gitlab.gnome.org/GNOME/mutter/issues/741
2020-08-04 04:42:29 -04:00
window - > skip_from_window_list = FALSE ;
2002-10-01 20:47:29 -04:00
window - > wm_state_above = FALSE ;
window - > wm_state_below = FALSE ;
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
window - > wm_state_demands_attention = FALSE ;
2008-12-18 07:41:56 -05:00
2001-06-09 17:58:30 -04:00
window - > res_class = NULL ;
window - > res_name = NULL ;
window - > role = NULL ;
window - > sm_client_id = NULL ;
2002-04-13 00:58:45 -04:00
window - > wm_client_machine = NULL ;
2013-02-20 15:17:21 -05:00
window - > is_remote = FALSE ;
2002-11-30 22:58:04 -05:00
window - > startup_id = NULL ;
2008-12-18 07:41:56 -05:00
2020-04-06 14:08:12 -04:00
window - > client_pid = 0 ;
2021-08-05 10:35:18 -04:00
window - > has_valid_cgroup = TRUE ;
window - > cgroup_path = NULL ;
2001-06-09 17:58:30 -04:00
window - > xtransient_for = None ;
window - > xclient_leader = None ;
2008-12-18 07:41:56 -05:00
2001-06-09 23:17:15 -04:00
window - > type = META_WINDOW_NORMAL ;
2001-06-10 03:27:11 -04:00
2003-06-25 23:09:38 -04:00
window - > struts = NULL ;
2002-08-12 17:32:13 -04:00
2002-09-28 12:33:39 -04:00
window - > layer = META_LAYER_LAST ; /* invalid value */
window - > stack_position = - 1 ;
2001-06-24 02:47:54 -04:00
window - > initial_workspace = 0 ; /* not used */
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
window - > initial_timestamp = 0 ; /* not used */
2008-10-31 08:57:47 -04:00
window - > compositor_private = NULL ;
2008-12-18 07:41:56 -05:00
2021-12-17 18:03:21 -05:00
if ( window - > rect . width > 0 & & window - > rect . height > 0 )
2022-08-03 16:55:56 -04:00
window - > monitor = meta_window_find_monitor_from_frame_rect ( window ) ;
2021-12-17 18:03:21 -05:00
else
window - > monitor = meta_backend_get_current_logical_monitor ( backend ) ;
2017-04-12 02:21:49 -04:00
if ( window - > monitor )
window - > preferred_output_winsys_id = window - > monitor - > winsys_id ;
else
window - > preferred_output_winsys_id = UINT_MAX ;
2011-02-25 10:37:05 -05:00
2016-01-10 09:16:09 -05:00
window - > tile_match = NULL ;
2009-09-18 20:50:11 -04:00
/* Assign this #MetaWindow a sequence number which can be used
* for sorting .
*/
window - > stable_sequence = + + display - > window_sequence_counter ;
2003-11-24 14:09:25 -05:00
2013-12-06 13:44:31 -05:00
window - > opacity = 0xFF ;
2013-09-10 09:53:31 -04:00
if ( window - > override_redirect )
{
window - > decorated = FALSE ;
window - > always_sticky = TRUE ;
window - > has_close_func = FALSE ;
window - > has_shade_func = FALSE ;
window - > has_move_func = FALSE ;
window - > has_resize_func = FALSE ;
}
2018-09-21 11:49:36 -04:00
window - > id = meta_display_generate_window_id ( display ) ;
2019-08-29 13:34:18 -04:00
meta_window_manage ( window ) ;
2014-07-10 17:08:14 -04:00
2001-06-04 02:17:52 -04:00
if ( window - > initially_iconic )
{
2001-06-06 00:47:37 -04:00
/* WM_HINTS said minimized */
window - > minimized = TRUE ;
2020-10-02 11:47:22 -04:00
meta_verbose ( " Window %s asked to start out minimized " , window - > desc ) ;
2001-06-04 02:17:52 -04:00
}
2001-06-24 02:47:54 -04:00
2002-11-30 22:58:04 -05:00
/* Apply any window attributes such as initial workspace
* based on startup notification
*/
2022-05-16 10:48:01 -04:00
meta_display_apply_startup_properties ( display , window ) ;
2007-11-09 15:41:45 -05:00
/* Try to get a "launch timestamp" for the window. If the window is
* a transient , we ' d like to be able to get a last - usage timestamp
* from the parent window . If the window has no parent , there isn ' t
* much we can do . . . except record the current time so that any children
* can use this time as a fallback .
*/
2009-06-14 08:37:57 -04:00
if ( ! window - > override_redirect & & ! window - > net_wm_user_time_set ) {
2008-02-26 23:39:10 -05:00
/* First, maybe the app was launched with startup notification using an
* obsolete version of the spec ; use that timestamp if it exists .
*/
2007-11-09 15:41:45 -05:00
if ( window - > initial_timestamp_set )
2008-02-26 23:39:10 -05:00
/* NOTE: Do NOT toggle net_wm_user_time_set to true; this is just
* being recorded as a fallback for potential transients
*/
2007-11-09 15:41:45 -05:00
window - > net_wm_user_time = window - > initial_timestamp ;
2013-09-16 08:44:37 -04:00
else if ( window - > transient_for ! = NULL )
meta_window_set_user_time ( window , window - > transient_for - > net_wm_user_time ) ;
2007-11-09 15:41:45 -05:00
else
2008-02-26 23:39:10 -05:00
/* NOTE: Do NOT toggle net_wm_user_time_set to true; this is just
* being recorded as a fallback for potential transients
*/
2007-11-09 15:41:45 -05:00
window - > net_wm_user_time =
2022-05-16 10:48:01 -04:00
meta_display_get_current_time_roundtrip ( display ) ;
2007-11-09 15:41:45 -05:00
}
2008-12-18 07:41:56 -05:00
window: make determination of attached dialog windows more consistent
Different bits of code were using slightly different checks to test
whether a window was an attached dialog. Add a new
meta_window_is_attached_dialog(), and use that everywhere.
Also, freeze the is-attached status when the window is first shown,
rather than recomputing it each time the caller asks, since this could
cause problems if a window changes its type after it has already been
attached, etc. However, if an attached window's parent is destroyed,
or an attached window changes its transient-for, then fix things up by
destroying the old MetaWindow and creating a new one (causing
compositor unmap and map events to be fired off, allowing the display
of the window to be fixed up).
Remove some code in display.c that tried to fix existing windows if
the gconf setting changed, but which didn't actually do anything (at
least under gnome-shell). However, if 654643 was fixed then the new
behavior with this patch would be that changing the gconf setting
would affect new dialogs, but not existing ones.
https://bugzilla.gnome.org/show_bug.cgi?id=646761
2011-04-05 10:14:52 -04:00
window - > attached = meta_window_should_attach_to_parent ( window ) ;
if ( window - > attached )
2014-02-01 18:58:58 -05:00
meta_window_recalc_features ( window ) ;
window: make determination of attached dialog windows more consistent
Different bits of code were using slightly different checks to test
whether a window was an attached dialog. Add a new
meta_window_is_attached_dialog(), and use that everywhere.
Also, freeze the is-attached status when the window is first shown,
rather than recomputing it each time the caller asks, since this could
cause problems if a window changes its type after it has already been
attached, etc. However, if an attached window's parent is destroyed,
or an attached window changes its transient-for, then fix things up by
destroying the old MetaWindow and creating a new one (causing
compositor unmap and map events to be fired off, allowing the display
of the window to be fixed up).
Remove some code in display.c that tried to fix existing windows if
the gconf setting changed, but which didn't actually do anything (at
least under gnome-shell). However, if 654643 was fixed then the new
behavior with this patch would be that changing the gconf setting
would affect new dialogs, but not existing ones.
https://bugzilla.gnome.org/show_bug.cgi?id=646761
2011-04-05 10:14:52 -04:00
2003-12-14 14:19:40 -05:00
if ( window - > type = = META_WINDOW_DESKTOP | |
2011-02-28 05:41:23 -05:00
window - > type = = META_WINDOW_DOCK )
2003-12-14 14:19:40 -05:00
{
/* Change the default, but don't enforce this if the user
* focuses the dock / desktop and unsticks it using key shortcuts .
* Need to set this before adding to the workspaces so the MRU
* lists will be updated .
*/
2011-02-28 05:41:23 -05:00
window - > on_all_workspaces_requested = TRUE ;
2003-12-14 14:19:40 -05:00
}
2008-12-18 07:41:56 -05:00
2011-02-28 05:41:23 -05:00
window - > on_all_workspaces = should_be_on_all_workspaces ( window ) ;
2001-06-24 02:47:54 -04:00
/* For the workspace, first honor hints,
* if that fails put transients with parents ,
* otherwise put window on active space
*/
2008-12-18 07:41:56 -05:00
2001-06-24 02:47:54 -04:00
if ( window - > initial_workspace_set )
{
2014-09-25 06:46:16 -04:00
gboolean on_all_workspaces = window - > on_all_workspaces ;
MetaWorkspace * workspace = NULL ;
2014-08-16 13:22:05 -04:00
2002-02-06 22:07:56 -05:00
if ( window - > initial_workspace = = ( int ) 0xFFFFFFFF )
2001-10-24 21:39:36 -04:00
{
2002-03-03 23:54:46 -05:00
meta_topic ( META_DEBUG_PLACEMENT ,
2020-10-02 11:47:22 -04:00
" Window %s is initially on all spaces " ,
2002-03-03 23:54:46 -05:00
window - > desc ) ;
2008-12-18 07:41:56 -05:00
2003-12-14 14:19:40 -05:00
/* need to set on_all_workspaces first so that it will be
* added to all the MRU lists
*/
2011-02-28 05:41:23 -05:00
window - > on_all_workspaces_requested = TRUE ;
2014-08-16 13:22:05 -04:00
on_all_workspaces = TRUE ;
2001-10-24 21:39:36 -04:00
}
2014-09-25 06:46:16 -04:00
else if ( ! on_all_workspaces )
2001-10-24 21:39:36 -04:00
{
2002-03-03 23:54:46 -05:00
meta_topic ( META_DEBUG_PLACEMENT ,
2020-10-02 11:47:22 -04:00
" Window %s is initially on space %d " ,
2002-03-03 23:54:46 -05:00
window - > desc , window - > initial_workspace ) ;
2017-08-27 15:02:40 -04:00
workspace = meta_workspace_manager_get_workspace_by_index ( workspace_manager ,
window - > initial_workspace ) ;
2001-10-24 21:39:36 -04:00
}
2014-08-16 13:22:05 -04:00
2020-02-03 16:58:38 -05:00
/* Ignore when a window requests to be placed on a non-existent workspace
*/
if ( on_all_workspaces | | workspace ! = NULL )
set_workspace_state ( window , on_all_workspaces , workspace ) ;
2001-06-24 02:47:54 -04:00
}
2008-12-18 07:41:56 -05:00
2009-06-15 18:02:32 -04:00
/* override-redirect windows are subtly different from other windows
* with window - > on_all_workspaces = = TRUE . Other windows are part of
* some workspace ( so they can return to that if the flag is turned off ) ,
* but appear on other workspaces . override - redirect windows are part
* of no workspace .
*/
2014-09-26 06:39:31 -04:00
if ( ! window - > override_redirect & & window - > workspace = = NULL )
2001-06-24 02:47:54 -04:00
{
2014-09-26 06:39:31 -04:00
if ( window - > transient_for ! = NULL )
2009-06-15 18:02:32 -04:00
{
2014-08-16 13:22:05 -04:00
meta_topic ( META_DEBUG_PLACEMENT ,
2020-10-02 11:47:22 -04:00
" Putting window %s on same workspace as parent %s " ,
2014-08-16 13:22:05 -04:00
window - > desc , window - > transient_for - > desc ) ;
2008-12-18 07:41:56 -05:00
2019-10-29 12:48:00 -04:00
g_warn_if_fail ( ! window - > transient_for - > override_redirect ) ;
2014-08-16 13:22:05 -04:00
set_workspace_state ( window ,
2020-03-21 13:24:52 -04:00
window - > transient_for - > on_all_workspaces ,
2014-08-16 13:22:05 -04:00
window - > transient_for - > workspace ) ;
2001-06-24 02:47:54 -04:00
}
2019-07-19 11:48:42 -04:00
else if ( window - > on_all_workspaces )
2014-09-26 06:39:31 -04:00
{
meta_topic ( META_DEBUG_PLACEMENT ,
2020-10-02 11:47:22 -04:00
" Putting window %s on all workspaces " ,
2014-09-26 06:39:31 -04:00
window - > desc ) ;
set_workspace_state ( window , TRUE , NULL ) ;
}
else
2009-06-15 18:02:32 -04:00
{
meta_topic ( META_DEBUG_PLACEMENT ,
2020-10-02 11:47:22 -04:00
" Putting window %s on active workspace " ,
2009-06-15 18:02:32 -04:00
window - > desc ) ;
2008-12-18 07:41:56 -05:00
2017-08-27 15:02:40 -04:00
set_workspace_state ( window , FALSE , workspace_manager - > active_workspace ) ;
2009-06-15 18:02:32 -04:00
}
2008-12-18 07:41:56 -05:00
2009-06-14 08:37:57 -04:00
meta_window_update_struts ( window ) ;
}
2002-08-01 19:52:47 -04:00
2015-03-02 22:13:05 -05:00
meta_window_main_monitor_changed ( window , NULL ) ;
2011-02-28 15:26:11 -05:00
Fix several bugs with handling of fullscreen windows, causing them to not
2006-08-21 Elijah Newren <newren gmail com>
Fix several bugs with handling of fullscreen windows, causing them
to not actually be fullscreen. #343115 (and also #346927,
#350547, #351643, the recent additional WINE-related issue
mentioned on the mailing list, and probably others...)
* src/constraints.c (setup_constraint_info): if a window tries to
resize to fullscreen-size and it has a fullscreen function but
isn't actually marked as fullscreen then assist it by marking it
as such, (constrain_fully_onscreen, constrain_titlebar_visible):
ignore this constraint for fullscreen windows since such windows
have a separate specialized constraint
* src/stack.c (window_is_fullscreen_size, get_standalone_layer):
remove the old window_is_fullscreen_size() hack for detecting
windows to treat as fullscreen since it doesn't work well with the
new constraints framework (i.e. we needed a slightly different
hack)
* src/window.[ch] (meta_window_new_with_addrs): shuffle the order
of adding the window to the stack and moveresizing the window
since moveresizing can cause stack changes if the window's initial
size is fullscreen size, (meta_window_make_fullscreen,
meta_window_make_fullscreen_internal): split
meta_window_make_fullscreen() similar to meta_window_maximize() so
that constraints can make use of it
2006-08-21 14:08:05 -04:00
/* Must add window to stack before doing move/resize, since the
* window might have fullscreen size ( i . e . should have been
* fullscreen ' d ; acrobat is one such braindead case ; it withdraws
* and remaps its window whenever trying to become fullscreen . . . )
* and thus constraints may try to auto - fullscreen it which also
* means restacking it .
*/
2018-01-09 07:19:40 -05:00
if ( meta_window_is_stackable ( window ) )
2022-05-16 10:48:01 -04:00
meta_stack_add ( display - > stack , window ) ;
2018-01-09 07:19:40 -05:00
else if ( window - > override_redirect )
2009-06-15 14:31:04 -04:00
window - > layer = META_LAYER_OVERRIDE_REDIRECT ; /* otherwise set by MetaStack */
Fix several bugs with handling of fullscreen windows, causing them to not
2006-08-21 Elijah Newren <newren gmail com>
Fix several bugs with handling of fullscreen windows, causing them
to not actually be fullscreen. #343115 (and also #346927,
#350547, #351643, the recent additional WINE-related issue
mentioned on the mailing list, and probably others...)
* src/constraints.c (setup_constraint_info): if a window tries to
resize to fullscreen-size and it has a fullscreen function but
isn't actually marked as fullscreen then assist it by marking it
as such, (constrain_fully_onscreen, constrain_titlebar_visible):
ignore this constraint for fullscreen windows since such windows
have a separate specialized constraint
* src/stack.c (window_is_fullscreen_size, get_standalone_layer):
remove the old window_is_fullscreen_size() hack for detecting
windows to treat as fullscreen since it doesn't work well with the
new constraints framework (i.e. we needed a slightly different
hack)
* src/window.[ch] (meta_window_new_with_addrs): shuffle the order
of adding the window to the stack and moveresizing the window
since moveresizing can cause stack changes if the window's initial
size is fullscreen size, (meta_window_make_fullscreen,
meta_window_make_fullscreen_internal): split
meta_window_make_fullscreen() similar to meta_window_maximize() so
that constraints can make use of it
2006-08-21 14:08:05 -04:00
2008-11-23 14:28:40 -05:00
if ( ! window - > override_redirect )
{
/* FIXME we have a tendency to set this then immediately
* change it again .
*/
2014-02-01 19:03:33 -05:00
set_wm_state ( window ) ;
2008-11-23 14:28:40 -05:00
set_net_wm_state ( window ) ;
}
2005-01-25 21:47:49 -05:00
2022-05-16 10:48:01 -04:00
meta_compositor_add_window ( display - > compositor , window ) ;
2014-03-28 13:50:45 -04:00
window - > known_to_compositor = TRUE ;
2014-02-24 12:56:30 -05:00
2001-06-10 23:24:20 -04:00
/* Sync stack changes */
2022-05-16 10:48:01 -04:00
meta_stack_thaw ( display - > stack ) ;
2002-05-11 01:47:04 -04:00
2009-06-14 08:04:28 -04:00
/* Usually the we'll have queued a stack sync anyways, because we've
* added a new frame window or restacked . But if an undecorated
* window is mapped , already stacked in the right place , then we
* might need to do this explicitly .
*/
2022-05-16 10:48:01 -04:00
meta_stack_tracker_queue_sync_stack ( display - > stack_tracker ) ;
2009-06-14 08:04:28 -04:00
2002-05-11 01:47:04 -04:00
/* disable show desktop mode unless we're a desktop component */
2003-05-16 17:59:08 -04:00
maybe_leave_show_desktop_mode ( window ) ;
2008-12-18 07:41:56 -05:00
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
meta_window_queue ( window , META_QUEUE_CALC_SHOWING ) ;
2005-05-26 13:15:56 -04:00
/* See bug 303284; a transient of the given window can already exist, in which
* case we think it should probably be shown .
*/
meta_window_foreach_transient ( window ,
queue_calc_showing_func ,
NULL ) ;
2006-10-01 17:59:09 -04:00
/* See bug 334899; the window may have minimized ancestors
* which need to be shown .
*
* However , we shouldn ' t unminimize windows here when opening
* a new display because that breaks passing _NET_WM_STATE_HIDDEN
* between window managers when replacing them ; see bug 358042.
2008-03-28 14:44:59 -04:00
*
* And we shouldn ' t unminimize windows if they were initially
* iconic .
2006-04-16 23:54:49 -04:00
*/
2009-06-14 08:11:29 -04:00
if ( ! window - > override_redirect & &
! display - > display_opening & &
! window - > initially_iconic )
2006-10-01 17:59:09 -04:00
unminimize_window_and_all_transient_parents ( window ) ;
2002-10-21 17:44:35 -04:00
deleted and moved into window-props.c (meta_window_new_with_attrs): added
2006-03-25 Thomas Thurman <thomas@thurman.org.uk>
* src/window.c, src/window.h (update_net_wm_state,
update_mwm_hints, update_wm_class, update_transient_for):
deleted and moved into window-props.c
(meta_window_new_with_attrs): added constructing field
and four new initial properties (as above)
(meta_window_recalc_features,
meta_window_recalc_window_type): new functions
* src/window-props.c (init_net_wm_state, reload_net_wm_state
init_mwm_hints, reload_mwm_hints, init_wm_class,
reload_mwm_class, init_transient_for, reload_transient_for):
new functions, moved in from window.c
(meta_display_init_window_prop_hooks): initialise new properties
2006-03-25 17:57:22 -05:00
window - > constructing = FALSE ;
2022-11-21 07:13:07 -05:00
}
static gboolean
meta_window_initable_init ( GInitable * initable ,
GCancellable * cancellable ,
GError * * error )
{
MetaWindow * window = META_WINDOW ( initable ) ;
MetaDisplay * display = window - > display ;
deleted and moved into window-props.c (meta_window_new_with_attrs): added
2006-03-25 Thomas Thurman <thomas@thurman.org.uk>
* src/window.c, src/window.h (update_net_wm_state,
update_mwm_hints, update_wm_class, update_transient_for):
deleted and moved into window-props.c
(meta_window_new_with_attrs): added constructing field
and four new initial properties (as above)
(meta_window_recalc_features,
meta_window_recalc_window_type): new functions
* src/window-props.c (init_net_wm_state, reload_net_wm_state
init_mwm_hints, reload_mwm_hints, init_wm_class,
reload_mwm_class, init_transient_for, reload_transient_for):
new functions, moved in from window.c
(meta_display_init_window_prop_hooks): initialise new properties
2006-03-25 17:57:22 -05:00
2009-10-13 10:34:34 -04:00
meta_display_notify_window_created ( display , window ) ;
2009-10-28 13:19:24 -04:00
if ( window - > wm_state_demands_attention )
2022-05-16 10:48:01 -04:00
g_signal_emit_by_name ( display , " window-demands-attention " , window ) ;
2022-11-21 07:13:07 -05:00
return TRUE ;
}
static void
initable_iface_init ( GInitableIface * initable_iface )
{
initable_iface - > init = meta_window_initable_init ;
2012-01-07 17:21:32 -05:00
}
window: make determination of attached dialog windows more consistent
Different bits of code were using slightly different checks to test
whether a window was an attached dialog. Add a new
meta_window_is_attached_dialog(), and use that everywhere.
Also, freeze the is-attached status when the window is first shown,
rather than recomputing it each time the caller asks, since this could
cause problems if a window changes its type after it has already been
attached, etc. However, if an attached window's parent is destroyed,
or an attached window changes its transient-for, then fix things up by
destroying the old MetaWindow and creating a new one (causing
compositor unmap and map events to be fired off, allowing the display
of the window to be fixed up).
Remove some code in display.c that tried to fix existing windows if
the gconf setting changed, but which didn't actually do anything (at
least under gnome-shell). However, if 654643 was fixed then the new
behavior with this patch would be that changing the gconf setting
would affect new dialogs, but not existing ones.
https://bugzilla.gnome.org/show_bug.cgi?id=646761
2011-04-05 10:14:52 -04:00
static gboolean
detach_foreach_func ( MetaWindow * window ,
void * data )
{
GList * * children = data ;
MetaWindow * parent ;
if ( window - > attached )
{
/* Only return the immediate children of the window being unmanaged */
parent = meta_window_get_transient_for ( window ) ;
if ( parent - > unmanaging )
* children = g_list_prepend ( * children , window ) ;
}
return TRUE ;
}
2001-05-30 11:36:31 -04:00
void
2008-11-07 04:57:00 -05:00
meta_window_unmanage ( MetaWindow * window ,
guint32 timestamp )
2001-05-30 11:36:31 -04:00
{
2017-08-27 15:02:40 -04:00
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
2001-06-06 00:47:37 -04:00
GList * tmp ;
2008-12-18 07:41:56 -05:00
2020-10-02 11:47:22 -04:00
meta_verbose ( " Unmanaging %s " , window - > desc ) ;
2016-03-17 09:52:46 -04:00
window - > unmanaging = TRUE ;
2001-06-06 00:47:37 -04:00
2019-11-21 18:25:30 -05:00
g_clear_handle_id ( & window - > unmanage_idle_id , g_source_remove ) ;
2021-09-03 17:38:12 -04:00
g_clear_handle_id ( & window - > close_dialog_timeout_id , g_source_remove ) ;
2018-10-18 10:24:18 -04:00
wayland: Move MetaWindow ownership to window owning roles
There are two surface roles owning a MetaWindow: MetaWaylandShellSurface
(basis of MetaWaylandXdgToplevel, MetaWaylandXdgPopup,
MetaWaylandWlShellSurface, etc), and MetaXwaylandSurface.
With these two role types, the MetaWindow has two different types of
life times. With MetaWaylandShellSurface, the window is owned and
managed by the role itself, while with MetaXwaylandSurface, the
MetaWindow is tied to the X11 window, while the Wayland surface and its
role plays more the role of the backing rendering surface.
Before, for historical reasons, MetaWindow was part of
MetaWaylandSurface, even though just some roles used it, and before
'wayland: Untie MetaWindowXwayland lifetime from the wl_surface' had
equivalent life times as well. But since that commit, the management
changed. To not have the same fied in MetaWaylandSurface being managed
in such drastically different ways, rearrange it so that the roles that
has a MetaWindow themself manages it in the way it is meant to; meaning
MetaWaylandShellSurface practically owns it, while with Xwayland, the
existance of a MetaWindow is tracked via X11.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
2019-10-09 03:57:40 -04:00
g_signal_emit ( window , window_signals [ UNMANAGING ] , 0 ) ;
2019-04-29 13:46:37 -04:00
wayland: Move MetaWindow ownership to window owning roles
There are two surface roles owning a MetaWindow: MetaWaylandShellSurface
(basis of MetaWaylandXdgToplevel, MetaWaylandXdgPopup,
MetaWaylandWlShellSurface, etc), and MetaXwaylandSurface.
With these two role types, the MetaWindow has two different types of
life times. With MetaWaylandShellSurface, the window is owned and
managed by the role itself, while with MetaXwaylandSurface, the
MetaWindow is tied to the X11 window, while the Wayland surface and its
role plays more the role of the backing rendering surface.
Before, for historical reasons, MetaWindow was part of
MetaWaylandSurface, even though just some roles used it, and before
'wayland: Untie MetaWindowXwayland lifetime from the wl_surface' had
equivalent life times as well. But since that commit, the management
changed. To not have the same fied in MetaWaylandSurface being managed
in such drastically different ways, rearrange it so that the roles that
has a MetaWindow themself manages it in the way it is meant to; meaning
MetaWaylandShellSurface practically owns it, while with Xwayland, the
existance of a MetaWindow is tracked via X11.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
2019-10-09 03:57:40 -04:00
meta_window_free_delete_dialog ( window ) ;
2014-02-18 16:39:23 -05:00
2014-03-18 17:06:42 -04:00
if ( window - > visible_to_compositor )
2014-03-28 13:51:34 -04:00
{
window - > visible_to_compositor = FALSE ;
meta_compositor_hide_window ( window - > display - > compositor , window ,
META_COMP_EFFECT_DESTROY ) ;
}
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
2014-03-18 17:06:42 -04:00
meta_compositor_remove_window ( window - > display - > compositor , window ) ;
2014-03-28 13:50:45 -04:00
window - > known_to_compositor = FALSE ;
2008-12-18 07:41:56 -05:00
2014-09-08 21:20:14 -04:00
meta_display_unregister_stamp ( window - > display , window - > stamp ) ;
window: make determination of attached dialog windows more consistent
Different bits of code were using slightly different checks to test
whether a window was an attached dialog. Add a new
meta_window_is_attached_dialog(), and use that everywhere.
Also, freeze the is-attached status when the window is first shown,
rather than recomputing it each time the caller asks, since this could
cause problems if a window changes its type after it has already been
attached, etc. However, if an attached window's parent is destroyed,
or an attached window changes its transient-for, then fix things up by
destroying the old MetaWindow and creating a new one (causing
compositor unmap and map events to be fired off, allowing the display
of the window to be fixed up).
Remove some code in display.c that tried to fix existing windows if
the gconf setting changed, but which didn't actually do anything (at
least under gnome-shell). However, if 654643 was fixed then the new
behavior with this patch would be that changing the gconf setting
would affect new dialogs, but not existing ones.
https://bugzilla.gnome.org/show_bug.cgi?id=646761
2011-04-05 10:14:52 -04:00
if ( meta_prefs_get_attach_modal_dialogs ( ) )
{
GList * attached_children = NULL , * iter ;
/* Detach any attached dialogs by unmapping and letting them
* be remapped after @ window is destroyed .
*/
meta_window_foreach_transient ( window ,
detach_foreach_func ,
& attached_children ) ;
for ( iter = attached_children ; iter ; iter = iter - > next )
meta_window_unmanage ( iter - > data , timestamp ) ;
g_list_free ( attached_children ) ;
}
2014-06-23 19:45:15 -04:00
/* Make sure to only show window on all workspaces if requested, to
* not confuse other window managers that may take over
*/
2017-08-26 15:43:17 -04:00
if ( meta_prefs_get_workspaces_only_on_primary ( ) )
2014-08-16 13:22:05 -04:00
meta_window_on_all_workspaces_changed ( window ) ;
2014-06-23 19:45:15 -04:00
2002-08-25 16:59:09 -04:00
if ( window - > fullscreen )
{
MetaGroup * group ;
/* If the window is fullscreen, it may be forcing
* other windows in its group to a higher layer
*/
2017-08-26 13:03:51 -04:00
meta_stack_freeze ( window - > display - > stack ) ;
2002-08-25 16:59:09 -04:00
group = meta_window_get_group ( window ) ;
if ( group )
meta_group_update_layers ( group ) ;
2017-08-26 13:03:51 -04:00
meta_stack_thaw ( window - > display - > stack ) ;
2002-08-25 16:59:09 -04:00
}
2002-10-27 09:45:29 -05:00
2014-07-08 12:16:11 -04:00
meta_display_remove_pending_pings_for_window ( window - > display , window ) ;
2014-07-08 12:45:34 -04:00
/* safe to do this early as group.c won't re-add to the
* group if window - > unmanaging */
meta_window_shutdown_group ( window ) ;
2008-12-18 07:41:56 -05:00
2002-01-03 18:28:19 -05:00
/* If we have the focus, focus some other window.
* This is done first , so that if the unmap causes
* an EnterNotify the EnterNotify will have final say
* on what gets focused , maintaining sloppy focus
* invariants .
*/
2019-10-12 14:55:26 -04:00
if ( window - > appears_focused )
2011-04-13 17:08:12 -04:00
meta_window_propagate_focus_appearance ( window , FALSE ) ;
2002-01-03 18:28:19 -05:00
if ( window - > has_focus )
{
meta_topic ( META_DEBUG_FOCUS ,
2020-10-02 11:47:22 -04:00
" Focusing default window since we're unmanaging %s " ,
2002-01-03 18:28:19 -05:00
window - > desc ) ;
2018-05-25 15:24:17 -04:00
meta_workspace_focus_default_window ( workspace_manager - > active_workspace ,
window ,
timestamp ) ;
2002-01-03 18:28:19 -05:00
}
else
{
meta_topic ( META_DEBUG_FOCUS ,
2020-10-02 11:47:22 -04:00
" Unmanaging window %s which doesn't currently have focus " ,
2002-01-03 18:28:19 -05:00
window - > desc ) ;
}
2002-01-10 22:31:14 -05:00
2011-04-26 08:12:04 -04:00
g_assert ( window - > display - > focus_window ! = window ) ;
2003-06-25 23:09:38 -04:00
if ( window - > struts )
2002-02-07 22:34:26 -05:00
{
2019-05-15 15:28:55 -04:00
g_slist_free_full ( window - > struts , g_free ) ;
2003-06-25 23:09:38 -04:00
window - > struts = NULL ;
2002-02-07 22:34:26 -05:00
meta_topic ( META_DEBUG_WORKAREA ,
2020-10-02 11:47:22 -04:00
" Unmanaging window %s which has struts, so invalidating work areas " ,
2002-02-07 22:34:26 -05:00
window - > desc ) ;
invalidate_work_areas ( window ) ;
}
2008-12-18 07:41:56 -05:00
2006-03-06 11:33:33 -05:00
if ( window - > maximized_horizontally | | window - > maximized_vertically )
unmaximize_window_before_freeing ( window ) ;
2007-04-12 00:02:57 -04:00
2022-01-28 18:02:24 -05:00
meta_window_unqueue ( window ,
( META_QUEUE_CALC_SHOWING |
META_QUEUE_MOVE_RESIZE ) ) ;
2008-12-18 07:41:56 -05:00
2014-08-16 13:22:05 -04:00
set_workspace_state ( window , FALSE , NULL ) ;
2001-06-06 00:47:37 -04:00
Partially resolve the conflicting requirements of windows on multiple
2004-12-22 Elijah Newren <newren@gmail.com>
Partially resolve the conflicting requirements of windows on
multiple workspaces and hidden being a global quantity for windows
(fixes bug 156182; the remainder of the work is bug 87531 and is a
libwnck issue)
* src/display.c (event_callback):
* src/window.c (meta_window_visible_on_workspace, meta_window_unstick):
* src/workspace.c (meta_workspace_add_window,
meta_workspace_contains_window,
meta_workspace_queue_calc_showing):
* src/workspace.h:
Remove meta_workspace_contains_window, replace with simple
comparison utilizing window->workspace
* src/place.c (meta_window_place):
* src/window.c (meta_window_shares_some_workspace):
* src/window.h:
Remove meta_window_shares_some_workspace, replace with a simple
comparison utilizing window->workspace
* src/session.c (save_state),
* src/window.c (meta_window_new_with_attrs,
meta_window_apply_session_info, meta_window_free,
window_showing_on_its_workspace,
meta_window_change_workspace_without_transients,
meta_window_unstick, meta_window_set_current_workspace_hint,
meta_window_get_workspaces):
* src/window.h:
* src/workspace.c (meta_workspace_free, meta_workspace_add_window,
meta_workspace_remove_window):
Only one workspace now
2004-12-22 18:52:52 -05:00
g_assert ( window - > workspace = = NULL ) ;
2001-06-07 01:18:10 -04:00
2003-12-12 22:58:55 -05:00
# ifndef G_DISABLE_CHECKS
2017-08-27 15:02:40 -04:00
tmp = workspace_manager - > workspaces ;
2003-12-12 22:58:55 -05:00
while ( tmp ! = NULL )
{
MetaWorkspace * workspace = tmp - > data ;
g_assert ( g_list_find ( workspace - > windows , window ) = = NULL ) ;
g_assert ( g_list_find ( workspace - > mru_list , window ) = = NULL ) ;
tmp = tmp - > next ;
}
# endif
2008-12-18 07:41:56 -05:00
2011-02-28 15:26:11 -05:00
if ( window - > monitor )
{
2016-11-25 01:31:38 -05:00
const MetaLogicalMonitor * old = window - > monitor ;
2015-03-02 22:13:05 -05:00
2011-02-28 15:26:11 -05:00
window - > monitor = NULL ;
2015-03-02 22:13:05 -05:00
meta_window_main_monitor_changed ( window , old ) ;
2011-02-28 15:26:11 -05:00
}
2018-01-09 07:19:40 -05:00
if ( meta_window_is_in_stack ( window ) )
2017-08-26 13:03:51 -04:00
meta_stack_remove ( window - > display - > stack , window ) ;
2008-12-18 07:41:56 -05:00
2009-06-14 08:04:28 -04:00
/* If an undecorated window is being withdrawn, that will change the
* stack as presented to the compositing manager , without actually
* changing the stacking order of X windows .
*/
2017-08-26 13:03:51 -04:00
meta_stack_tracker_queue_sync_stack ( window - > display - > stack_tracker ) ;
2009-06-14 08:04:28 -04:00
2013-10-16 00:19:33 -04:00
if ( window - > display - > autoraise_window = = window )
meta_display_remove_autoraise_callback ( window - > display ) ;
2008-12-18 07:41:56 -05:00
2014-03-19 09:36:15 -04:00
META_WINDOW_GET_CLASS ( window ) - > unmanage ( window ) ;
2002-02-09 18:03:52 -05:00
2012-02-29 16:31:30 -05:00
meta_prefs_remove_listener ( prefs_changed_callback , window ) ;
2017-08-26 15:10:38 -04:00
meta_display_queue_check_fullscreen ( window - > display ) ;
2013-03-14 16:55:49 -04:00
2009-10-13 10:34:34 -04:00
g_signal_emit ( window , window_signals [ UNMANAGED ] , 0 ) ;
2008-11-07 04:57:00 -05:00
g_object_unref ( window ) ;
2001-05-30 11:36:31 -04:00
}
2011-03-08 17:15:56 -05:00
static void
2014-02-01 19:03:33 -05:00
set_wm_state ( MetaWindow * window )
2011-03-08 17:15:56 -05:00
{
2014-02-01 19:19:22 -05:00
if ( window - > client_type = = META_WINDOW_CLIENT_TYPE_X11 )
meta_window_x11_set_wm_state ( window ) ;
2001-06-10 23:24:20 -04:00
}
2002-10-21 17:44:35 -04:00
static void
2001-06-10 23:24:20 -04:00
set_net_wm_state ( MetaWindow * window )
{
2014-01-23 16:33:53 -05:00
if ( window - > client_type = = META_WINDOW_CLIENT_TYPE_X11 )
meta_window_x11_set_net_wm_state ( window ) ;
2001-06-06 00:47:37 -04:00
}
2014-04-29 15:18:40 -04:00
static void
set_allowed_actions_hint ( MetaWindow * window )
{
if ( window - > client_type = = META_WINDOW_CLIENT_TYPE_X11 )
meta_window_x11_set_allowed_actions_hint ( window ) ;
}
2013-01-14 12:34:14 -05:00
/**
* meta_window_located_on_workspace :
* @ window : a # MetaWindow
* @ workspace : a # MetaWorkspace
*
2013-02-15 13:42:08 -05:00
* Returns : whether @ window is displayed on @ workspace , or whether it
2013-01-14 12:34:14 -05:00
* will be displayed on all workspaces .
*/
2001-10-25 00:51:25 -04:00
gboolean
2004-12-22 19:20:33 -05:00
meta_window_located_on_workspace ( MetaWindow * window ,
2001-10-25 00:51:25 -04:00
MetaWorkspace * workspace )
{
2014-08-15 19:43:08 -04:00
return ( window - > on_all_workspaces ) | | ( window - > workspace = = workspace ) ;
2001-10-25 00:51:25 -04:00
}
2003-03-17 01:36:39 -05:00
static gboolean
is_minimized_foreach ( MetaWindow * window ,
void * data )
{
gboolean * result = data ;
* result = window - > minimized ;
if ( * result )
return FALSE ; /* stop as soon as we find one */
else
return TRUE ;
}
static gboolean
ancestor_is_minimized ( MetaWindow * window )
{
gboolean is_minimized ;
is_minimized = FALSE ;
meta_window_foreach_ancestor ( window , is_minimized_foreach , & is_minimized ) ;
return is_minimized ;
}
2011-03-09 10:01:44 -05:00
/**
* meta_window_showing_on_its_workspace :
* @ window : A # MetaWindow
*
* Returns : % TRUE if window would be visible , if its workspace was current
*/
2005-01-28 09:48:47 -05:00
gboolean
meta_window_showing_on_its_workspace ( MetaWindow * window )
2001-06-06 00:47:37 -04:00
{
2004-10-22 16:28:36 -04:00
gboolean showing ;
2003-11-08 00:29:23 -05:00
gboolean is_desktop_or_dock ;
2004-10-22 16:28:36 -04:00
MetaWorkspace * workspace_of_window ;
2001-07-03 22:10:54 -04:00
2004-10-22 16:28:36 -04:00
showing = TRUE ;
2001-10-14 23:39:41 -04:00
2004-10-22 16:28:36 -04:00
/* 1. See if we're minimized */
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
if ( window - > minimized )
showing = FALSE ;
2008-12-18 07:41:56 -05:00
2004-10-22 16:28:36 -04:00
/* 2. See if we're in "show desktop" mode */
2003-11-08 00:29:23 -05:00
is_desktop_or_dock = FALSE ;
is_desktop_or_dock_foreach ( window ,
& is_desktop_or_dock ) ;
meta_window_foreach_ancestor ( window , is_desktop_or_dock_foreach ,
& is_desktop_or_dock ) ;
2022-06-11 05:44:19 -04:00
workspace_of_window = meta_window_get_workspace ( window ) ;
2004-10-22 16:28:36 -04:00
2008-12-18 07:41:56 -05:00
if ( showing & &
2004-10-22 16:28:36 -04:00
workspace_of_window & & workspace_of_window - > showing_desktop & &
2003-11-08 00:29:23 -05:00
! is_desktop_or_dock )
2001-10-14 23:39:41 -04:00
{
2020-10-02 11:47:22 -04:00
meta_verbose ( " We're showing the desktop on the workspace(s) that window %s is on " ,
2001-10-14 23:39:41 -04:00
window - > desc ) ;
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
showing = FALSE ;
2001-10-14 23:39:41 -04:00
}
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
2004-10-22 16:28:36 -04:00
/* 3. See if an ancestor is minimized (note that
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
* ancestor ' s " mapped " field may not be up to date
* since it ' s being computed in this same idle queue )
*/
2008-12-18 07:41:56 -05:00
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
if ( showing )
{
2003-03-17 01:36:39 -05:00
if ( ancestor_is_minimized ( window ) )
showing = FALSE ;
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
}
2002-11-03 15:30:45 -05:00
return showing ;
}
2004-12-19 21:53:08 -05:00
gboolean
meta_window_should_be_showing ( MetaWindow * window )
2004-10-22 16:28:36 -04:00
{
2017-08-27 15:02:40 -04:00
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
2015-06-17 06:37:20 -04:00
# ifdef HAVE_WAYLAND
2022-05-18 07:51:44 -04:00
if ( window - > client_type = = META_WINDOW_CLIENT_TYPE_WAYLAND )
{
MetaWaylandSurface * surface = meta_window_get_wayland_surface ( window ) ;
if ( ! meta_wayland_surface_get_buffer ( surface ) )
return FALSE ;
}
2015-06-17 06:37:20 -04:00
# endif
2015-06-08 05:55:54 -04:00
x11: Integrate frames client into Mutter
Replace the in-process implementation of frames with the external
frames client.
When a client window is created and managed by Mutter, Mutter will
determine whether it is a window that requires decorations and
hint the creation of a frame for it by setting the _MUTTER_NEEDS_FRAME
property on the client window.
After the frames client created a window that has the _MUTTER_FRAME_FOR
property, Mutter will proceed to reparent the client window on the
frame window, and show them as a single unit.
Rendering and event handling on the frame window will be performed by
the external client, Mutter is still responsible for everything else,
namely resizing client and frame window in synchronization, and
managing updates on the MetaWindowActor.
In order to let the frame be managed by the external client, Mutter
needs to change the way some properties are forwarded to the client
and/or frame windows. Some properties are necessary to keep propagating
to the client window only, some others need to happen on the frame
window now, and some others needs to be propagated on both so they
are synchronized about the behavior.
Also, some events that were previously totally unexpected in frame
windows are now susceptible to happen, so must be allowed now.
MetaFrame in src/core/frame.c now acts as the wrapper of foreign
windows created by the frames client, from the Mutter side. Location,
size, and lifetime are still largely in control of Mutter, some
details like visible/invisible borders are obtained from the client
instead (through the _MUTTER_FRAME_EXTENTS and _GTK_FRAME_EXTENTS
properties, respectively).
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2175>
2022-09-08 04:35:47 -04:00
if ( window - > client_type = = META_WINDOW_CLIENT_TYPE_X11 & &
window - > decorated & & ! window - > frame )
return FALSE ;
2014-08-16 13:22:05 -04:00
/* Windows should be showing if they're located on the
* active workspace and they ' re showing on their own workspace . */
2017-08-27 15:02:40 -04:00
return ( meta_window_located_on_workspace ( window , workspace_manager - > active_workspace ) & &
2014-08-16 13:22:05 -04:00
meta_window_showing_on_its_workspace ( window ) ) ;
2004-10-22 16:28:36 -04:00
}
2002-11-03 15:30:45 -05:00
static void
implement_showing ( MetaWindow * window ,
gboolean showing )
{
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
/* Actually show/hide the window */
2020-10-02 11:47:22 -04:00
meta_verbose ( " Implement showing = %d for window %s " ,
2002-11-03 18:42:21 -05:00
showing , window - > desc ) ;
2008-12-18 07:41:56 -05:00
2018-01-09 07:19:40 -05:00
/* Some windows are not stackable until being showed, so add those now. */
if ( meta_window_is_stackable ( window ) & & ! meta_window_is_in_stack ( window ) )
2017-08-26 13:03:51 -04:00
meta_stack_add ( window - > display - > stack , window ) ;
2018-01-09 07:19:40 -05:00
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
if ( ! showing )
2011-02-02 19:14:27 -05:00
{
/* When we manage a new window, we normally delay placing it
* until it is is first shown , but if we ' re previewing hidden
* windows we might want to know where they are on the screen ,
* so we should place the window even if we ' re hiding it rather
* than showing it .
2015-07-10 11:24:55 -04:00
* Force placing windows only when they should be already mapped ,
* see # 751887
2011-02-02 19:14:27 -05:00
*/
2015-07-10 11:24:55 -04:00
if ( ! window - > placed & & client_window_should_be_mapped ( window ) )
2017-06-21 07:30:22 -04:00
meta_window_force_placement ( window , FALSE ) ;
2011-02-02 19:14:27 -05:00
meta_window_hide ( window ) ;
2022-11-20 13:24:07 -05:00
if ( ! window - > override_redirect )
sync_client_window_mapped ( window ) ;
2011-02-02 19:14:27 -05:00
}
2001-06-06 00:47:37 -04:00
else
2022-11-20 13:24:07 -05:00
{
if ( ! window - > override_redirect )
sync_client_window_mapped ( window ) ;
2014-09-01 14:44:48 -04:00
2022-11-20 13:24:07 -05:00
meta_window_show ( window ) ;
}
2001-06-06 00:47:37 -04:00
}
2001-06-21 23:20:21 -04:00
2022-01-28 18:49:50 -05:00
void
meta_window_update_visibility ( MetaWindow * window )
2002-11-03 15:30:45 -05:00
{
2004-12-19 21:53:08 -05:00
implement_showing ( window , meta_window_should_be_showing ( window ) ) ;
2002-11-03 15:30:45 -05:00
}
2001-06-21 23:20:21 -04:00
2022-01-28 18:49:50 -05:00
void
meta_window_clear_queued ( MetaWindow * window )
2001-06-24 04:09:10 -04:00
{
2022-01-28 18:49:50 -05:00
MetaWindowPrivate * priv = meta_window_get_instance_private ( window ) ;
2001-06-24 04:09:10 -04:00
2022-01-28 18:49:50 -05:00
priv - > queued_types & = ~ META_QUEUE_CALC_SHOWING ;
2001-06-24 04:09:10 -04:00
}
2006-01-20 17:03:56 -05:00
static void
2022-01-28 18:21:59 -05:00
meta_window_unqueue ( MetaWindow * window ,
2022-01-28 18:49:50 -05:00
MetaQueueType queue_types )
2001-06-21 23:20:21 -04:00
{
2022-01-28 18:49:50 -05:00
MetaWindowPrivate * priv = meta_window_get_instance_private ( window ) ;
2001-10-29 21:00:53 -05:00
2022-01-28 18:49:50 -05:00
queue_types & = priv - > queued_types ;
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
2022-01-28 18:49:50 -05:00
if ( ! queue_types )
return ;
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
2022-01-28 18:49:50 -05:00
meta_display_unqueue_window ( window - > display , window , queue_types ) ;
priv - > queued_types & = ~ queue_types ;
2001-06-21 23:20:21 -04:00
}
2006-01-20 17:03:56 -05:00
static void
2001-10-29 02:00:46 -05:00
meta_window_flush_calc_showing ( MetaWindow * window )
{
2022-01-28 18:49:50 -05:00
MetaWindowPrivate * priv = meta_window_get_instance_private ( window ) ;
2022-05-13 13:12:52 -04:00
if ( ! ( priv - > queued_types & META_QUEUE_CALC_SHOWING ) )
return ;
meta_display_flush_queued_window ( window - > display , window ,
META_QUEUE_CALC_SHOWING ) ;
priv - > queued_types & = ~ META_QUEUE_CALC_SHOWING ;
2001-10-29 02:00:46 -05:00
}
2001-06-06 00:47:37 -04:00
void
2022-01-28 16:12:23 -05:00
meta_window_queue ( MetaWindow * window ,
2022-01-28 18:49:50 -05:00
MetaQueueType queue_types )
2001-06-06 00:47:37 -04:00
{
2022-01-28 18:49:50 -05:00
MetaWindowPrivate * priv = meta_window_get_instance_private ( window ) ;
2001-06-21 23:20:21 -04:00
2022-01-28 16:12:23 -05:00
g_return_if_fail ( ! window - > override_redirect | |
2022-01-28 18:49:50 -05:00
( queue_types & META_QUEUE_MOVE_RESIZE ) = = 0 ) ;
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
2022-01-28 18:49:50 -05:00
if ( window - > unmanaging )
return ;
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
2022-01-28 18:49:50 -05:00
queue_types & = ~ priv - > queued_types ;
if ( ! queue_types )
return ;
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
2022-01-28 18:49:50 -05:00
priv - > queued_types | = queue_types ;
meta_display_queue_window ( window - > display , window , queue_types ) ;
2001-06-06 00:47:37 -04:00
}
2002-06-14 21:46:13 -04:00
static gboolean
2005-02-12 02:19:41 -05:00
intervening_user_event_occurred ( MetaWindow * window )
2002-06-14 21:46:13 -04:00
{
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
guint32 compare ;
2005-02-12 02:19:41 -05:00
MetaWindow * focus_window ;
focus_window = window - > display - > focus_window ;
meta_topic ( META_DEBUG_STARTUP ,
" COMPARISON: \n "
" net_wm_user_time_set : %d \n "
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
" net_wm_user_time : %u \n "
2005-02-12 02:19:41 -05:00
" initial_timestamp_set: %d \n "
2020-10-02 11:47:22 -04:00
" initial_timestamp : %u " ,
2005-02-12 02:19:41 -05:00
window - > net_wm_user_time_set ,
window - > net_wm_user_time ,
window - > initial_timestamp_set ,
window - > initial_timestamp ) ;
if ( focus_window ! = NULL )
{
meta_topic ( META_DEBUG_STARTUP ,
" COMPARISON (continued): \n "
2006-08-09 14:32:30 -04:00
" focus_window : %s \n "
" fw->net_wm_user_time_set : %d \n "
2020-10-02 11:47:22 -04:00
" fw->net_wm_user_time : %u " ,
2005-02-12 02:19:41 -05:00
focus_window - > desc ,
2006-08-09 14:32:30 -04:00
focus_window - > net_wm_user_time_set ,
2005-02-12 02:19:41 -05:00
focus_window - > net_wm_user_time ) ;
}
/* We expect the most common case for not focusing a new window
* to be when a hint to not focus it has been set . Since we can
* deal with that case rapidly , we use special case it - - this is
* merely a preliminary optimization . : )
*/
if ( ( ( window - > net_wm_user_time_set = = TRUE ) & &
( window - > net_wm_user_time = = 0 ) )
| |
( ( window - > initial_timestamp_set = = TRUE ) & &
( window - > initial_timestamp = = 0 ) ) )
{
meta_topic ( META_DEBUG_STARTUP ,
2020-10-02 11:47:22 -04:00
" window %s explicitly requested no focus " ,
2005-02-12 02:19:41 -05:00
window - > desc ) ;
return TRUE ;
}
if ( ! ( window - > net_wm_user_time_set ) & & ! ( window - > initial_timestamp_set ) )
{
meta_topic ( META_DEBUG_STARTUP ,
2020-10-02 11:47:22 -04:00
" no information about window %s found " ,
2005-02-12 02:19:41 -05:00
window - > desc ) ;
2007-11-09 14:01:31 -05:00
return FALSE ;
2005-02-12 02:19:41 -05:00
}
2006-08-09 14:32:30 -04:00
if ( focus_window ! = NULL & &
! focus_window - > net_wm_user_time_set )
{
meta_topic ( META_DEBUG_STARTUP ,
2020-10-02 11:47:22 -04:00
" focus window, %s, doesn't have a user time set yet! " ,
2006-08-09 14:32:30 -04:00
window - > desc ) ;
return FALSE ;
}
2005-02-12 02:19:41 -05:00
/* To determine the "launch" time of an application,
* startup - notification can set the TIMESTAMP and the
* application ( usually via its toolkit such as gtk or qt ) can
2009-08-08 12:59:01 -04:00
* set the _NET_WM_USER_TIME . If both are set , we need to be
* using the newer of the two values .
*
* See http : //bugzilla.gnome.org/show_bug.cgi?id=573922
2005-02-12 02:19:41 -05:00
*/
2009-08-08 12:59:01 -04:00
compare = 0 ;
if ( window - > net_wm_user_time_set & &
window - > initial_timestamp_set )
compare =
XSERVER_TIME_IS_BEFORE ( window - > net_wm_user_time ,
window - > initial_timestamp ) ?
window - > initial_timestamp : window - > net_wm_user_time ;
else if ( window - > net_wm_user_time_set )
compare = window - > net_wm_user_time ;
else if ( window - > initial_timestamp_set )
compare = window - > initial_timestamp ;
2005-02-12 02:19:41 -05:00
if ( ( focus_window ! = NULL ) & &
XSERVER_TIME_IS_BEFORE ( compare , focus_window - > net_wm_user_time ) )
{
meta_topic ( META_DEBUG_STARTUP ,
2020-10-02 11:47:22 -04:00
" window %s focus prevented by other activity; %u < %u " ,
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
window - > desc ,
2008-12-18 07:41:56 -05:00
compare ,
2005-02-12 02:19:41 -05:00
focus_window - > net_wm_user_time ) ;
return TRUE ;
}
else
{
meta_topic ( META_DEBUG_STARTUP ,
2020-10-02 11:47:22 -04:00
" new window %s with no intervening events " ,
2005-02-12 02:19:41 -05:00
window - > desc ) ;
return FALSE ;
}
}
2006-01-10 13:33:53 -05:00
/* This function is an ugly hack. It's experimental in nature and ought to be
* replaced by a real hint from the app to the WM if we decide the experimental
* behavior is worthwhile . The basic idea is to get more feedback about how
* usage scenarios of " strict " focus users and what they expect . See # 326159.
*/
2014-03-18 10:08:28 -04:00
static gboolean
window_is_terminal ( MetaWindow * window )
2006-01-10 13:33:53 -05:00
{
2006-10-29 15:30:18 -05:00
if ( window = = NULL | | window - > res_class = = NULL )
2006-01-10 13:33:53 -05:00
return FALSE ;
2006-10-29 15:30:18 -05:00
/*
* Compare res_class , which is not user - settable , and thus theoretically
* a more - reliable indication of term - ness .
*/
2006-01-10 13:33:53 -05:00
/* gnome-terminal -- if you couldn't guess */
2006-10-29 15:30:18 -05:00
if ( strcmp ( window - > res_class , " Gnome-terminal " ) = = 0 )
2006-01-10 13:33:53 -05:00
return TRUE ;
/* xterm, rxvt, aterm */
2006-10-29 15:30:18 -05:00
else if ( strcmp ( window - > res_class , " XTerm " ) = = 0 )
2006-01-10 13:33:53 -05:00
return TRUE ;
/* konsole, KDE's terminal program */
2006-10-29 15:30:18 -05:00
else if ( strcmp ( window - > res_class , " Konsole " ) = = 0 )
2006-01-10 13:33:53 -05:00
return TRUE ;
/* rxvt-unicode */
2006-10-29 15:30:18 -05:00
else if ( strcmp ( window - > res_class , " URxvt " ) = = 0 )
2006-01-10 13:33:53 -05:00
return TRUE ;
/* eterm */
2006-10-29 15:30:18 -05:00
else if ( strcmp ( window - > res_class , " Eterm " ) = = 0 )
2006-01-10 13:33:53 -05:00
return TRUE ;
/* KTerm -- some terminal not KDE based; so not like Konsole */
2006-10-29 15:30:18 -05:00
else if ( strcmp ( window - > res_class , " KTerm " ) = = 0 )
2006-01-10 13:33:53 -05:00
return TRUE ;
/* Multi-gnome-terminal */
2006-10-29 15:30:18 -05:00
else if ( strcmp ( window - > res_class , " Multi-gnome-terminal " ) = = 0 )
2006-01-10 13:33:53 -05:00
return TRUE ;
/* mlterm ("multi lingual terminal emulator on X") */
2006-10-29 15:30:18 -05:00
else if ( strcmp ( window - > res_class , " mlterm " ) = = 0 )
2006-01-10 13:33:53 -05:00
return TRUE ;
2009-10-21 21:11:46 -04:00
/* Terminal -- XFCE Terminal */
else if ( strcmp ( window - > res_class , " Terminal " ) = = 0 )
return TRUE ;
2006-01-10 13:33:53 -05:00
return FALSE ;
}
2005-02-12 02:19:41 -05:00
/* This function determines what state the window should have assuming that it
* and the focus_window have no relation
*/
static void
2008-12-18 07:41:56 -05:00
window_state_on_map ( MetaWindow * window ,
2005-02-12 02:19:41 -05:00
gboolean * takes_focus ,
gboolean * places_on_top )
{
gboolean intervening_events ;
intervening_events = intervening_user_event_occurred ( window ) ;
* takes_focus = ! intervening_events ;
* places_on_top = * takes_focus ;
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
2002-06-14 21:46:13 -04:00
/* don't initially focus windows that are intended to not accept
* focus
*/
2018-11-13 02:56:53 -05:00
if ( ! meta_window_is_focusable ( window ) )
2005-02-12 02:19:41 -05:00
{
* takes_focus = FALSE ;
return ;
}
2002-06-14 21:46:13 -04:00
2006-04-12 14:01:20 -04:00
/* Terminal usage may be different; some users intend to launch
2006-01-10 13:33:53 -05:00
* many apps in quick succession or to just view things in the new
2006-04-12 14:01:20 -04:00
* window while still interacting with the terminal . In that case ,
2006-01-10 13:33:53 -05:00
* apps launched from the terminal should not take focus . This
* isn ' t quite the same as not allowing focus to transfer from
* terminals due to new window map , but the latter is a much easier
* approximation to enforce so we do that .
*/
if ( * takes_focus & &
2011-06-24 12:14:15 -04:00
meta_prefs_get_focus_new_windows ( ) = = G_DESKTOP_FOCUS_NEW_WINDOWS_STRICT & &
2006-01-15 12:03:57 -05:00
! window - > display - > allow_terminal_deactivation & &
2014-03-18 10:08:28 -04:00
window_is_terminal ( window - > display - > focus_window ) & &
2006-01-10 13:33:53 -05:00
! meta_window_is_ancestor_of_transient ( window - > display - > focus_window ,
window ) )
{
meta_topic ( META_DEBUG_FOCUS ,
2020-10-02 11:47:22 -04:00
" focus_window is terminal; not focusing new window. " ) ;
2006-01-10 13:33:53 -05:00
* takes_focus = FALSE ;
* places_on_top = FALSE ;
}
2002-06-14 21:46:13 -04:00
switch ( window - > type )
{
2005-02-12 02:19:41 -05:00
case META_WINDOW_UTILITY :
case META_WINDOW_TOOLBAR :
* takes_focus = FALSE ;
* places_on_top = FALSE ;
break ;
2002-06-14 21:46:13 -04:00
case META_WINDOW_DOCK :
case META_WINDOW_DESKTOP :
case META_WINDOW_SPLASHSCREEN :
case META_WINDOW_MENU :
2008-11-23 14:28:40 -05:00
/* override redirect types: */
case META_WINDOW_DROPDOWN_MENU :
case META_WINDOW_POPUP_MENU :
case META_WINDOW_TOOLTIP :
case META_WINDOW_NOTIFICATION :
case META_WINDOW_COMBO :
case META_WINDOW_DND :
case META_WINDOW_OVERRIDE_OTHER :
2005-02-12 02:19:41 -05:00
/* don't focus any of these; places_on_top may be irrelevant for some of
* these ( e . g . dock ) - - but you never know - - the focus window might also be
* of the same type in some weird situation . . .
*/
* takes_focus = FALSE ;
2002-06-14 21:46:13 -04:00
break ;
case META_WINDOW_NORMAL :
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
case META_WINDOW_DIALOG :
case META_WINDOW_MODAL_DIALOG :
2005-02-12 02:19:41 -05:00
/* The default is correct for these */
2002-06-14 21:46:13 -04:00
break ;
}
}
2006-01-10 00:14:48 -05:00
static gboolean
windows_overlap ( const MetaWindow * w1 , const MetaWindow * w2 )
{
MetaRectangle w1rect , w2rect ;
2013-11-19 12:24:45 -05:00
meta_window_get_frame_rect ( w1 , & w1rect ) ;
meta_window_get_frame_rect ( w2 , & w2rect ) ;
2006-01-10 00:14:48 -05:00
return meta_rectangle_overlap ( & w1rect , & w2rect ) ;
}
2007-10-16 18:29:59 -04:00
/* Returns whether a new window would be covered by any
* existing window on the same workspace that is set
* to be " above " ( " always on top " ) . A window that is not
* set " above " would be underneath the new window anyway .
*
* We take " covered " to mean even partially covered , but
* some people might prefer entirely covered . I think it
* is more useful to behave this way if any part of the
* window is covered , because a partial coverage could be
* ( say ) ninety per cent and almost indistinguishable from total .
*/
static gboolean
window_would_be_covered ( const MetaWindow * newbie )
{
2014-09-26 22:11:00 -04:00
MetaWorkspace * workspace = meta_window_get_workspace ( ( MetaWindow * ) newbie ) ;
2007-10-16 18:29:59 -04:00
GList * tmp , * windows ;
2008-12-18 07:41:56 -05:00
2007-10-16 18:29:59 -04:00
windows = meta_workspace_list_windows ( workspace ) ;
tmp = windows ;
while ( tmp ! = NULL )
2008-12-18 07:41:56 -05:00
{
2007-10-16 18:29:59 -04:00
MetaWindow * w = tmp - > data ;
2008-03-18 08:22:25 -04:00
if ( w - > wm_state_above & & w ! = newbie )
2007-10-16 18:29:59 -04:00
{
/* We have found a window that is "above". Perhaps it overlaps. */
if ( windows_overlap ( w , newbie ) )
{
g_list_free ( windows ) ; /* clean up... */
return TRUE ; /* yes, it does */
}
}
tmp = tmp - > next ;
}
g_list_free ( windows ) ;
return FALSE ; /* none found */
}
2016-02-01 05:46:11 -05:00
void
2017-06-21 07:30:22 -04:00
meta_window_force_placement ( MetaWindow * window ,
gboolean force_move )
2011-02-02 19:14:27 -05:00
{
2017-06-21 07:30:22 -04:00
MetaMoveResizeFlags flags ;
2011-02-02 19:14:27 -05:00
if ( window - > placed )
return ;
/* We have to recalc the placement here since other windows may
* have been mapped / placed since we last did constrain_position
*/
/* calc_placement is an efficiency hack to avoid
* multiple placement calculations before we finally
* show the window .
*/
window - > calc_placement = TRUE ;
2017-06-21 07:30:22 -04:00
2022-03-04 09:23:38 -05:00
flags = ( META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION |
META_MOVE_RESIZE_CONSTRAIN ) ;
2017-06-21 07:30:22 -04:00
if ( force_move )
flags | = META_MOVE_RESIZE_FORCE_MOVE ;
meta_window_move_resize_internal ( window ,
flags ,
2020-02-14 03:44:43 -05:00
META_GRAVITY_NORTH_WEST ,
2017-06-21 07:30:22 -04:00
window - > unconstrained_rect ) ;
2011-02-02 19:14:27 -05:00
window - > calc_placement = FALSE ;
/* don't ever do the initial position constraint thing again.
* This is toggled here so that initially - iconified windows
* still get placed when they are ultimately shown .
*/
window - > placed = TRUE ;
/* Don't want to accidentally reuse the fact that we had been denied
* focus in any future constraints unless we ' re denied focus again .
*/
window - > denied_focus_and_not_transient = FALSE ;
}
2009-06-14 07:59:59 -04:00
static void
2001-06-02 00:14:18 -04:00
meta_window_show ( MetaWindow * window )
{
2002-02-08 01:01:58 -05:00
gboolean did_show ;
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
gboolean takes_focus_on_map ;
2005-02-12 02:19:41 -05:00
gboolean place_on_top_on_map ;
2006-01-10 00:14:48 -05:00
gboolean needs_stacking_adjustment ;
MetaWindow * focus_window ;
2009-11-17 05:02:06 -05:00
gboolean notify_demands_attention = FALSE ;
2018-12-30 06:58:31 -05:00
MetaDisplay * display = window - > display ;
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
2002-02-07 22:34:26 -05:00
meta_topic ( META_DEBUG_WINDOW_STATE ,
2020-10-02 11:47:22 -04:00
" Showing window %s, shaded: %d iconic: %d placed: %d " ,
2002-02-07 22:34:26 -05:00
window - > desc , window - > shaded , window - > iconic , window - > placed ) ;
2001-06-07 22:17:48 -04:00
2006-01-10 00:14:48 -05:00
focus_window = window - > display - > focus_window ; /* May be NULL! */
2002-02-08 01:01:58 -05:00
did_show = FALSE ;
2005-02-12 02:19:41 -05:00
window_state_on_map ( window , & takes_focus_on_map , & place_on_top_on_map ) ;
2006-01-10 00:14:48 -05:00
needs_stacking_adjustment = FALSE ;
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
2005-02-12 02:19:41 -05:00
meta_topic ( META_DEBUG_WINDOW_STATE ,
2020-10-02 11:47:22 -04:00
" Window %s %s focus on map, and %s place on top on map. " ,
2005-02-12 02:19:41 -05:00
window - > desc ,
takes_focus_on_map ? " does " : " does not " ,
place_on_top_on_map ? " does " : " does not " ) ;
2007-10-16 18:29:59 -04:00
/* Now, in some rare cases we should *not* put a new window on top.
2007-11-11 19:45:35 -05:00
* These cases include certain types of windows showing for the first
2007-10-16 18:29:59 -04:00
* time , and any window which would be covered because of another window
* being set " above " ( " always on top " ) .
*
* FIXME : Although " place_on_top_on_map " and " takes_focus_on_map " are
* generally based on the window type , there is a special case when the
* focus window is a terminal for them both to be false ; this should
* probably rather be a term in the " if " condition below .
*/
2007-11-11 19:45:35 -05:00
if ( focus_window ! = NULL & & window - > showing_for_first_time & &
( ( ! place_on_top_on_map & & ! takes_focus_on_map ) | |
window_would_be_covered ( window ) )
) {
2016-10-19 07:43:38 -04:00
if ( ! meta_window_is_ancestor_of_transient ( focus_window , window ) )
2004-10-25 12:28:57 -04:00
{
2006-01-10 00:14:48 -05:00
needs_stacking_adjustment = TRUE ;
2005-02-11 14:20:44 -05:00
if ( ! window - > placed )
window - > denied_focus_and_not_transient = TRUE ;
2004-10-25 12:28:57 -04:00
}
2004-08-05 13:48:39 -04:00
}
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
2001-06-24 04:09:10 -04:00
if ( ! window - > placed )
2012-03-15 15:42:11 -04:00
{
2017-09-25 14:11:22 -04:00
if ( window - > monitor & &
meta_prefs_get_auto_maximize ( ) & &
window - > showing_for_first_time & &
window - > has_maximize_func )
2012-03-15 15:42:11 -04:00
{
MetaRectangle work_area ;
meta_window_get_work_area_for_monitor ( window , window - > monitor - > number , & work_area ) ;
/* Automaximize windows that map with a size > MAX_UNMAXIMIZED_WINDOW_AREA of the work area */
if ( window - > rect . width * window - > rect . height > work_area . width * work_area . height * MAX_UNMAXIMIZED_WINDOW_AREA )
{
window - > maximize_horizontally_after_placement = TRUE ;
window - > maximize_vertically_after_placement = TRUE ;
}
}
2017-06-21 07:30:22 -04:00
meta_window_force_placement ( window , FALSE ) ;
2012-03-15 15:42:11 -04:00
}
2008-12-18 07:41:56 -05:00
2006-09-13 18:21:19 -04:00
if ( needs_stacking_adjustment )
{
2006-09-18 18:00:57 -04:00
gboolean overlap ;
2006-09-13 18:21:19 -04:00
/* This window isn't getting focus on map. We may need to do some
* special handing with it in regards to
* - the stacking of the window
* - the MRU position of the window
* - the demands attention setting of the window
2007-10-16 18:29:59 -04:00
*
* Firstly , set the flag so we don ' t give the window focus anyway
* and confuse people .
2006-09-13 18:21:19 -04:00
*/
2008-12-18 07:41:56 -05:00
2007-10-16 18:29:59 -04:00
takes_focus_on_map = FALSE ;
2006-09-13 18:21:19 -04:00
overlap = windows_overlap ( window , focus_window ) ;
/* We want alt tab to go to the denied-focus window */
ensure_mru_position_after ( window , focus_window ) ;
/* We don't want the denied-focus window to obscure the focus
* window , and if we ' re in both click - to - focus mode and
* raise - on - click mode then we want to maintain the invariant
* that MRU order = = stacking order . The need for this if
* comes from the fact that in sloppy / mouse focus the focus
* window may not overlap other windows and also can be
* considered " below " them ; this combination means that
* placing the denied - focus window " below " the focus window
* in the stack when it doesn ' t overlap it confusingly places
* that new window below a lot of other windows .
*/
2008-12-18 07:41:56 -05:00
if ( overlap | |
2011-06-24 12:14:15 -04:00
( meta_prefs_get_focus_mode ( ) = = G_DESKTOP_FOCUS_MODE_CLICK & &
2006-09-13 18:21:19 -04:00
meta_prefs_get_raise_on_click ( ) ) )
meta_window_stack_just_below ( window , focus_window ) ;
/* If the window will be obscured by the focus window, then the
* user might not notice the window appearing so set the
* demands attention hint .
*
2008-12-18 07:41:56 -05:00
* We set the hint ourselves rather than calling
2006-09-13 18:21:19 -04:00
* meta_window_set_demands_attention ( ) because that would cause
* a recalculation of overlap , and a call to set_net_wm_state ( )
* which we are going to call ourselves here a few lines down .
*/
if ( overlap )
2009-11-17 05:02:06 -05:00
{
if ( ! window - > wm_state_demands_attention )
{
window - > wm_state_demands_attention = TRUE ;
notify_demands_attention = TRUE ;
}
}
2008-12-18 07:41:56 -05:00
}
2006-09-13 18:21:19 -04:00
Always map the client and frame windows
Traditionally, WMs unmap windows when minimizing them, and map them
when restoring them or wanting to show them for other reasons, like
upon creation.
However, as metacity morphed into mutter, we optionally chose to keep
windows mapped for the lifetime of the window under the user option
"live-window-previews", which makes the code keep windows mapped so it
can show window preview for minimized windows in other places, like
Alt-Tab and Expose.
I removed this preference two years ago mechanically, by removing all
the if statements, but never went through and cleaned up the code so
that windows are simply mapped for the lifetime of the window -- the
"architecture" of the old code that maps and unmaps on show/hide was
still there.
Remove this now.
The one case we still need to be careful of is shaded windows, in which
we do still unmap the client window. In the future, we might want to
show previews of shaded windows in the overview and Alt-Tab. In that
we'd also keep shaded windows mapped, and could remove all unmap logic,
but we'd need a more complex method of showing the shaded titlebar, such
as using a different actor.
At the same time, simplify the compositor interface by removing
meta_compositor_window_[un]mapped API, and instead adding/removing the
window on-demand.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 19:06:51 -05:00
if ( window - > hidden )
2001-06-07 22:17:48 -04:00
{
2017-08-26 13:03:51 -04:00
meta_stack_freeze ( window - > display - > stack ) ;
Always map the client and frame windows
Traditionally, WMs unmap windows when minimizing them, and map them
when restoring them or wanting to show them for other reasons, like
upon creation.
However, as metacity morphed into mutter, we optionally chose to keep
windows mapped for the lifetime of the window under the user option
"live-window-previews", which makes the code keep windows mapped so it
can show window preview for minimized windows in other places, like
Alt-Tab and Expose.
I removed this preference two years ago mechanically, by removing all
the if statements, but never went through and cleaned up the code so
that windows are simply mapped for the lifetime of the window -- the
"architecture" of the old code that maps and unmaps on show/hide was
still there.
Remove this now.
The one case we still need to be careful of is shaded windows, in which
we do still unmap the client window. In the future, we might want to
show previews of shaded windows in the overview and Alt-Tab. In that
we'd also keep shaded windows mapped, and could remove all unmap logic,
but we'd need a more complex method of showing the shaded titlebar, such
as using a different actor.
At the same time, simplify the compositor interface by removing
meta_compositor_window_[un]mapped API, and instead adding/removing the
window on-demand.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 19:06:51 -05:00
window - > hidden = FALSE ;
2017-08-26 13:03:51 -04:00
meta_stack_thaw ( window - > display - > stack ) ;
Always map the client and frame windows
Traditionally, WMs unmap windows when minimizing them, and map them
when restoring them or wanting to show them for other reasons, like
upon creation.
However, as metacity morphed into mutter, we optionally chose to keep
windows mapped for the lifetime of the window under the user option
"live-window-previews", which makes the code keep windows mapped so it
can show window preview for minimized windows in other places, like
Alt-Tab and Expose.
I removed this preference two years ago mechanically, by removing all
the if statements, but never went through and cleaned up the code so
that windows are simply mapped for the lifetime of the window -- the
"architecture" of the old code that maps and unmaps on show/hide was
still there.
Remove this now.
The one case we still need to be careful of is shaded windows, in which
we do still unmap the client window. In the future, we might want to
show previews of shaded windows in the overview and Alt-Tab. In that
we'd also keep shaded windows mapped, and could remove all unmap logic,
but we'd need a more complex method of showing the shaded titlebar, such
as using a different actor.
At the same time, simplify the compositor interface by removing
meta_compositor_window_[un]mapped API, and instead adding/removing the
window on-demand.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 19:06:51 -05:00
did_show = TRUE ;
2014-01-22 09:16:56 -05:00
}
Always map the client and frame windows
Traditionally, WMs unmap windows when minimizing them, and map them
when restoring them or wanting to show them for other reasons, like
upon creation.
However, as metacity morphed into mutter, we optionally chose to keep
windows mapped for the lifetime of the window under the user option
"live-window-previews", which makes the code keep windows mapped so it
can show window preview for minimized windows in other places, like
Alt-Tab and Expose.
I removed this preference two years ago mechanically, by removing all
the if statements, but never went through and cleaned up the code so
that windows are simply mapped for the lifetime of the window -- the
"architecture" of the old code that maps and unmaps on show/hide was
still there.
Remove this now.
The one case we still need to be careful of is shaded windows, in which
we do still unmap the client window. In the future, we might want to
show previews of shaded windows in the overview and Alt-Tab. In that
we'd also keep shaded windows mapped, and could remove all unmap logic,
but we'd need a more complex method of showing the shaded titlebar, such
as using a different actor.
At the same time, simplify the compositor interface by removing
meta_compositor_window_[un]mapped API, and instead adding/removing the
window on-demand.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 19:06:51 -05:00
if ( window - > iconic )
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
{
Always map the client and frame windows
Traditionally, WMs unmap windows when minimizing them, and map them
when restoring them or wanting to show them for other reasons, like
upon creation.
However, as metacity morphed into mutter, we optionally chose to keep
windows mapped for the lifetime of the window under the user option
"live-window-previews", which makes the code keep windows mapped so it
can show window preview for minimized windows in other places, like
Alt-Tab and Expose.
I removed this preference two years ago mechanically, by removing all
the if statements, but never went through and cleaned up the code so
that windows are simply mapped for the lifetime of the window -- the
"architecture" of the old code that maps and unmaps on show/hide was
still there.
Remove this now.
The one case we still need to be careful of is shaded windows, in which
we do still unmap the client window. In the future, we might want to
show previews of shaded windows in the overview and Alt-Tab. In that
we'd also keep shaded windows mapped, and could remove all unmap logic,
but we'd need a more complex method of showing the shaded titlebar, such
as using a different actor.
At the same time, simplify the compositor interface by removing
meta_compositor_window_[un]mapped API, and instead adding/removing the
window on-demand.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 19:06:51 -05:00
window - > iconic = FALSE ;
set_wm_state ( window ) ;
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
}
2008-12-18 07:41:56 -05:00
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
if ( ! window - > visible_to_compositor )
{
2014-03-18 17:06:42 -04:00
MetaCompEffect effect = META_COMP_EFFECT_NONE ;
2011-01-04 11:43:02 -05:00
window - > visible_to_compositor = TRUE ;
2014-03-18 17:06:42 -04:00
switch ( window - > pending_compositor_effect )
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
{
2014-03-18 17:06:42 -04:00
case META_COMP_EFFECT_CREATE :
case META_COMP_EFFECT_UNMINIMIZE :
effect = window - > pending_compositor_effect ;
break ;
case META_COMP_EFFECT_NONE :
case META_COMP_EFFECT_DESTROY :
case META_COMP_EFFECT_MINIMIZE :
break ;
2009-01-12 11:41:06 -05:00
}
2014-03-18 17:06:42 -04:00
meta_compositor_show_window ( window - > display - > compositor ,
window , effect ) ;
2014-04-28 16:58:45 -04:00
window - > pending_compositor_effect = META_COMP_EFFECT_NONE ;
2001-06-06 00:47:37 -04:00
}
2001-10-29 21:00:53 -05:00
2004-12-28 01:01:42 -05:00
/* We don't want to worry about all cases from inside
* implement_showing ( ) ; we only want to worry about focus if this
* window has not been shown before .
*/
if ( window - > showing_for_first_time )
2001-10-29 21:00:53 -05:00
{
2004-12-28 01:01:42 -05:00
window - > showing_for_first_time = FALSE ;
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
if ( takes_focus_on_map )
2008-12-18 07:41:56 -05:00
{
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
guint32 timestamp ;
timestamp = meta_display_get_current_time_roundtrip ( window - > display ) ;
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 13:27:24 -04:00
meta_window_focus ( window , timestamp ) ;
2002-05-16 15:08:20 -04:00
}
2018-12-30 06:58:31 -05:00
else if ( display - > x11_display )
2004-10-25 12:28:57 -04:00
{
/* Prevent EnterNotify events in sloppy/mouse focus from
* erroneously focusing the window that had been denied
* focus . FIXME : This introduces a race ; I have a couple
* ideas for a better way to accomplish the same thing , but
* they ' re more involved so do it this way for now .
*/
2018-12-30 06:58:31 -05:00
meta_x11_display_increment_focus_sentinel ( display - > x11_display ) ;
2004-10-25 12:28:57 -04:00
}
2001-10-29 21:00:53 -05:00
}
2002-02-08 01:01:58 -05:00
2006-03-16 22:26:25 -05:00
set_net_wm_state ( window ) ;
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
2006-03-16 22:26:25 -05:00
if ( did_show & & window - > struts )
{
meta_topic ( META_DEBUG_WORKAREA ,
2020-10-02 11:47:22 -04:00
" Mapped window %s with struts, so invalidating work areas " ,
2006-03-16 22:26:25 -05:00
window - > desc ) ;
invalidate_work_areas ( window ) ;
2002-02-08 01:01:58 -05:00
}
2009-08-08 12:59:01 -04:00
2013-03-14 16:55:49 -04:00
if ( did_show )
2017-08-26 15:10:38 -04:00
meta_display_queue_check_fullscreen ( window - > display ) ;
2013-03-14 16:55:49 -04:00
2009-08-08 12:59:01 -04:00
/*
* Now that we have shown the window , we no longer want to consider the
* initial timestamp in any subsequent deliberations whether to focus this
* window or not , so clear the flag .
*
* See http : //bugzilla.gnome.org/show_bug.cgi?id=573922
*/
window - > initial_timestamp_set = FALSE ;
2009-11-17 05:02:06 -05:00
if ( notify_demands_attention )
2009-10-28 13:19:24 -04:00
{
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_DEMANDS_ATTENTION ] ) ;
2009-10-28 13:19:24 -04:00
g_signal_emit_by_name ( window - > display , " window-demands-attention " ,
window ) ;
}
2018-07-12 04:25:16 -04:00
if ( did_show )
g_signal_emit ( window , window_signals [ SHOWN ] , 0 ) ;
2001-06-02 00:14:18 -04:00
}
2006-01-13 14:41:01 -05:00
static void
2001-06-02 00:14:18 -04:00
meta_window_hide ( MetaWindow * window )
{
2017-08-27 15:02:40 -04:00
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
2002-01-10 22:31:14 -05:00
gboolean did_hide ;
2008-10-24 05:07:24 -04:00
2002-02-07 22:34:26 -05:00
meta_topic ( META_DEBUG_WINDOW_STATE ,
2020-10-02 11:47:22 -04:00
" Hiding window %s " , window - > desc ) ;
2002-01-10 22:31:14 -05:00
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
if ( window - > visible_to_compositor )
{
2014-03-18 17:06:42 -04:00
MetaCompEffect effect = META_COMP_EFFECT_NONE ;
2011-01-04 11:43:02 -05:00
window - > visible_to_compositor = FALSE ;
2014-03-18 17:06:42 -04:00
switch ( window - > pending_compositor_effect )
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
{
2014-03-18 17:06:42 -04:00
case META_COMP_EFFECT_CREATE :
case META_COMP_EFFECT_UNMINIMIZE :
case META_COMP_EFFECT_NONE :
break ;
case META_COMP_EFFECT_DESTROY :
case META_COMP_EFFECT_MINIMIZE :
effect = window - > pending_compositor_effect ;
break ;
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
}
2014-03-18 17:06:42 -04:00
meta_compositor_hide_window ( window - > display - > compositor , window , effect ) ;
2014-04-28 16:58:45 -04:00
window - > pending_compositor_effect = META_COMP_EFFECT_NONE ;
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
}
2002-01-10 22:31:14 -05:00
did_hide = FALSE ;
2008-10-24 05:07:24 -04:00
2012-02-29 22:15:12 -05:00
if ( ! window - > hidden )
2001-06-09 23:17:15 -04:00
{
2017-08-26 13:03:51 -04:00
meta_stack_freeze ( window - > display - > stack ) ;
2012-02-29 22:15:12 -05:00
window - > hidden = TRUE ;
2017-08-26 13:03:51 -04:00
meta_stack_thaw ( window - > display - > stack ) ;
2012-02-29 22:15:12 -05:00
did_hide = TRUE ;
2001-06-09 23:17:15 -04:00
}
2001-06-04 02:17:52 -04:00
2001-06-06 00:47:37 -04:00
if ( ! window - > iconic )
{
window - > iconic = TRUE ;
2014-02-01 19:03:33 -05:00
set_wm_state ( window ) ;
2001-06-06 00:47:37 -04:00
}
2008-12-18 07:41:56 -05:00
2006-03-16 22:26:25 -05:00
set_net_wm_state ( window ) ;
2008-12-18 07:41:56 -05:00
2006-03-16 22:26:25 -05:00
if ( did_hide & & window - > struts )
{
meta_topic ( META_DEBUG_WORKAREA ,
2020-10-02 11:47:22 -04:00
" Unmapped window %s with struts, so invalidating work areas " ,
2006-03-16 22:26:25 -05:00
window - > desc ) ;
invalidate_work_areas ( window ) ;
2002-01-10 22:31:14 -05:00
}
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
2011-04-26 08:12:04 -04:00
if ( window - > has_focus )
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
{
MetaWindow * not_this_one = NULL ;
MetaWorkspace * my_workspace = meta_window_get_workspace ( window ) ;
guint32 timestamp = meta_display_get_current_time_roundtrip ( window - > display ) ;
/*
* If this window is modal , passing the not_this_one window to
* _focus_default_window ( ) makes the focus to be given to this window ' s
* ancestor . This can only be the case if the window is on the currently
* active workspace ; when it is not , we need to pass in NULL , so as to
* focus the default window for the active workspace ( this scenario
* arises when we are switching workspaces ) .
2012-10-26 08:39:21 -04:00
* We also pass in NULL if we are in the process of hiding all non - desktop
* windows to avoid unexpected changes to the stacking order .
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
*/
2017-08-27 15:02:40 -04:00
if ( my_workspace = = workspace_manager - > active_workspace & &
2012-10-26 08:39:21 -04:00
! my_workspace - > showing_desktop )
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
not_this_one = window ;
2017-08-27 15:02:40 -04:00
meta_workspace_focus_default_window ( workspace_manager - > active_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 17:10:40 -04:00
not_this_one ,
timestamp ) ;
}
2013-03-14 16:55:49 -04:00
if ( did_hide )
2017-08-26 15:10:38 -04:00
meta_display_queue_check_fullscreen ( window - > display ) ;
2001-06-04 02:17:52 -04:00
}
2003-03-17 01:36:39 -05:00
static gboolean
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
queue_calc_showing_func ( MetaWindow * window ,
void * data )
{
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
meta_window_queue ( window , META_QUEUE_CALC_SHOWING ) ;
2003-03-17 01:36:39 -05:00
return TRUE ;
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
}
2001-06-04 02:17:52 -04:00
void
meta_window_minimize ( MetaWindow * window )
{
2022-10-14 15:56:10 -04:00
g_return_if_fail ( META_IS_WINDOW ( window ) ) ;
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2022-06-30 07:56:21 -04:00
if ( ! window - > has_minimize_func )
{
g_warning ( " Window %s cannot be minimized, but something tried "
" anyways. Not having it! " , window - > desc ) ;
return ;
}
2001-06-04 02:17:52 -04:00
if ( ! window - > minimized )
{
window - > minimized = TRUE ;
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
window - > pending_compositor_effect = META_COMP_EFFECT_MINIMIZE ;
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
meta_window_queue ( window , META_QUEUE_CALC_SHOWING ) ;
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
meta_window_foreach_transient ( window ,
queue_calc_showing_func ,
NULL ) ;
2008-12-18 07:41:56 -05:00
2002-01-03 18:28:19 -05:00
if ( window - > has_focus )
{
meta_topic ( META_DEBUG_FOCUS ,
2020-10-02 11:47:22 -04:00
" Focusing default window due to minimization of focus window %s " ,
2002-01-03 18:28:19 -05:00
window - > desc ) ;
}
else
{
meta_topic ( META_DEBUG_FOCUS ,
2020-10-02 11:47:22 -04:00
" Minimizing window %s which doesn't have the focus " ,
2002-01-03 18:28:19 -05:00
window - > desc ) ;
}
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_MINIMIZED ] ) ;
2001-06-04 02:17:52 -04:00
}
}
void
meta_window_unminimize ( MetaWindow * window )
{
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2001-06-04 02:17:52 -04:00
if ( window - > minimized )
{
window - > minimized = FALSE ;
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
window - > pending_compositor_effect = META_COMP_EFFECT_UNMINIMIZE ;
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
meta_window_queue ( window , META_QUEUE_CALC_SHOWING ) ;
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
meta_window_foreach_transient ( window ,
queue_calc_showing_func ,
NULL ) ;
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_MINIMIZED ] ) ;
2001-06-07 01:18:10 -04:00
}
}
2007-04-04 17:54:56 -04:00
static void
ensure_size_hints_satisfied ( MetaRectangle * rect ,
const XSizeHints * size_hints )
{
int minw , minh , maxw , maxh ; /* min/max width/height */
int basew , baseh , winc , hinc ; /* base width/height, width/height increment */
int extra_width , extra_height ;
minw = size_hints - > min_width ; minh = size_hints - > min_height ;
maxw = size_hints - > max_width ; maxh = size_hints - > max_height ;
basew = size_hints - > base_width ; baseh = size_hints - > base_height ;
winc = size_hints - > width_inc ; hinc = size_hints - > height_inc ;
2008-12-18 07:41:56 -05:00
2007-04-04 17:54:56 -04:00
/* First, enforce min/max size constraints */
rect - > width = CLAMP ( rect - > width , minw , maxw ) ;
rect - > height = CLAMP ( rect - > height , minh , maxh ) ;
/* Now, verify size increment constraints are satisfied, or make them be */
extra_width = ( rect - > width - basew ) % winc ;
extra_height = ( rect - > height - baseh ) % hinc ;
rect - > width - = extra_width ;
rect - > height - = extra_height ;
/* Adjusting width/height down, as done above, may violate minimum size
* constraints , so one last fix .
*/
if ( rect - > width < minw )
rect - > width + = ( ( minw - rect - > width ) / winc + 1 ) * winc ;
if ( rect - > height < minh )
rect - > height + = ( ( minh - rect - > height ) / hinc + 1 ) * hinc ;
}
2002-09-24 17:33:34 -04:00
static void
2016-01-10 09:16:09 -05:00
meta_window_save_rect ( MetaWindow * window )
2002-09-24 17:33:34 -04:00
{
2016-01-10 09:16:09 -05:00
if ( ! ( META_WINDOW_MAXIMIZED ( window ) | | META_WINDOW_TILED_SIDE_BY_SIDE ( window ) | | window - > fullscreen ) )
2016-01-10 09:16:09 -05:00
{
/* save size/pos as appropriate args for move_resize */
if ( ! window - > maximized_horizontally )
{
window - > saved_rect . x = window - > rect . x ;
window - > saved_rect . width = window - > rect . width ;
}
if ( ! window - > maximized_vertically )
{
window - > saved_rect . y = window - > rect . y ;
window - > saved_rect . height = window - > rect . height ;
}
}
2002-09-24 17:33:34 -04:00
}
2003-06-09 19:49:02 -04:00
void
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
meta_window_maximize_internal ( MetaWindow * window ,
MetaMaximizeFlags directions ,
MetaRectangle * saved_rect )
2003-06-09 19:49:02 -04:00
{
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
/* At least one of the two directions ought to be set */
gboolean maximize_horizontally , maximize_vertically ;
maximize_horizontally = directions & META_MAXIMIZE_HORIZONTAL ;
maximize_vertically = directions & META_MAXIMIZE_VERTICAL ;
g_assert ( maximize_horizontally | | maximize_vertically ) ;
2003-06-09 19:49:02 -04:00
meta_topic ( META_DEBUG_WINDOW_OPS ,
2020-10-02 11:47:22 -04:00
" Maximizing %s%s " ,
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
window - > desc ,
maximize_horizontally & & maximize_vertically ? " " :
maximize_horizontally ? " horizontally " :
maximize_vertically ? " vertically " : " BUGGGGG " ) ;
2008-12-18 07:41:56 -05:00
2016-01-10 09:16:09 -05:00
if ( saved_rect ! = NULL )
window - > saved_rect = * saved_rect ;
else
meta_window_save_rect ( window ) ;
2008-12-18 07:41:56 -05:00
2016-01-10 09:16:09 -05:00
if ( maximize_horizontally & & maximize_vertically )
window - > saved_maximize = TRUE ;
2008-12-18 07:41:56 -05:00
window - > maximized_horizontally =
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
window - > maximized_horizontally | | maximize_horizontally ;
2008-12-18 07:41:56 -05:00
window - > maximized_vertically =
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
window - > maximized_vertically | | maximize_vertically ;
2006-07-31 15:56:56 -04:00
2017-08-16 23:43:21 -04:00
/* Update the edge constraints */
2020-07-28 04:11:07 -04:00
update_edge_constraints ( window ) ;
2017-08-16 23:43:21 -04:00
2014-02-01 18:58:58 -05:00
meta_window_recalc_features ( window ) ;
2003-06-09 19:49:02 -04:00
set_net_wm_state ( window ) ;
2010-02-12 15:26:52 -05:00
2019-01-09 05:52:18 -05:00
if ( window - > monitor & & window - > monitor - > in_fullscreen )
2017-08-26 15:10:38 -04:00
meta_display_queue_check_fullscreen ( window - > display ) ;
2014-10-02 18:55:45 -04:00
2010-02-12 15:26:52 -05:00
g_object_freeze_notify ( G_OBJECT ( window ) ) ;
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_MAXIMIZED_HORIZONTALLY ] ) ;
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_MAXIMIZED_VERTICALLY ] ) ;
2010-02-12 15:26:52 -05:00
g_object_thaw_notify ( G_OBJECT ( window ) ) ;
2003-06-09 19:49:02 -04:00
}
2001-06-07 01:18:10 -04:00
void
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
meta_window_maximize ( MetaWindow * window ,
MetaMaximizeFlags directions )
2001-06-07 01:18:10 -04:00
{
2016-01-10 09:16:09 -05:00
MetaRectangle * saved_rect = NULL ;
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
gboolean maximize_horizontally , maximize_vertically ;
2009-06-14 08:11:29 -04:00
2022-10-14 15:56:10 -04:00
g_return_if_fail ( META_IS_WINDOW ( window ) ) ;
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
/* At least one of the two directions ought to be set */
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
maximize_horizontally = directions & META_MAXIMIZE_HORIZONTAL ;
maximize_vertically = directions & META_MAXIMIZE_VERTICAL ;
g_assert ( maximize_horizontally | | maximize_vertically ) ;
/* Only do something if the window isn't already maximized in the
* given direction ( s ) .
*/
if ( ( maximize_horizontally & & ! window - > maximized_horizontally ) | |
( maximize_vertically & & ! window - > maximized_vertically ) )
2001-06-07 01:18:10 -04:00
{
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
if ( window - > shaded & & maximize_vertically )
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 13:27:24 -04:00
{
/* Shading sucks anyway; I'm not adding a timestamp argument
* to this function just for this niche usage & corner case .
*/
2008-12-18 07:41:56 -05:00
guint32 timestamp =
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 13:27:24 -04:00
meta_display_get_current_time_roundtrip ( window - > display ) ;
meta_window_unshade ( window , timestamp ) ;
}
2008-12-18 07:41:56 -05:00
2003-06-09 19:49:02 -04:00
/* if the window hasn't been placed yet, we'll maximize it then
*/
if ( ! window - > placed )
{
2008-12-18 07:41:56 -05:00
window - > maximize_horizontally_after_placement =
window - > maximize_horizontally_after_placement | |
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
maximize_horizontally ;
2008-12-18 07:41:56 -05:00
window - > maximize_vertically_after_placement =
window - > maximize_vertically_after_placement | |
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
maximize_vertically ;
2003-06-09 19:49:02 -04:00
return ;
}
2016-01-10 09:16:09 -05:00
if ( window - > tile_mode ! = META_TILE_NONE )
{
saved_rect = & window - > saved_rect ;
window - > maximized_vertically = FALSE ;
window - > tile_mode = META_TILE_NONE ;
}
meta_window_maximize_internal ( window ,
directions ,
saved_rect ) ;
2001-10-14 18:13:53 -04:00
2016-09-26 10:30:54 -04:00
MetaRectangle old_frame_rect , old_buffer_rect ;
2015-07-06 00:08:08 -04:00
meta_window_get_frame_rect ( window , & old_frame_rect ) ;
meta_window_get_buffer_rect ( window , & old_buffer_rect ) ;
2008-11-23 14:28:40 -05:00
2016-09-26 10:30:54 -04:00
meta_compositor_size_change_window ( window - > display - > compositor , window ,
META_SIZE_CHANGE_MAXIMIZE ,
& old_frame_rect , & old_buffer_rect ) ;
2014-12-15 16:44:22 -05:00
meta_window_move_resize_internal ( window ,
2015-07-06 00:08:08 -04:00
( META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION |
2022-03-04 09:23:38 -05:00
META_MOVE_RESIZE_STATE_CHANGED |
META_MOVE_RESIZE_CONSTRAIN ) ,
2020-02-14 03:44:43 -05:00
META_GRAVITY_NORTH_WEST ,
2014-12-15 16:44:22 -05:00
window - > unconstrained_rect ) ;
2001-06-07 01:18:10 -04:00
}
}
2010-11-11 18:42:44 -05:00
/**
* meta_window_get_maximized :
2013-02-15 13:42:08 -05:00
* @ window : a # MetaWindow
2010-11-11 18:42:44 -05:00
*
* Gets the current maximization state of the window , as combination
* of the % META_MAXIMIZE_HORIZONTAL and % META_MAXIMIZE_VERTICAL flags ;
*
* Return value : current maximization state
*/
MetaMaximizeFlags
meta_window_get_maximized ( MetaWindow * window )
{
return ( ( window - > maximized_horizontally ? META_MAXIMIZE_HORIZONTAL : 0 ) |
( window - > maximized_vertically ? META_MAXIMIZE_VERTICAL : 0 ) ) ;
}
/**
* meta_window_is_fullscreen :
2013-02-15 13:42:08 -05:00
* @ window : a # MetaWindow
2010-11-11 18:42:44 -05:00
*
* Return value : % TRUE if the window is currently fullscreen
*/
gboolean
meta_window_is_fullscreen ( MetaWindow * window )
{
return window - > fullscreen ;
}
2013-02-18 07:30:37 -05:00
/**
* meta_window_is_screen_sized :
2013-02-15 13:42:08 -05:00
* @ window : A # MetaWindow
2013-02-18 07:30:37 -05:00
*
* Return value : % TRUE if the window is occupies the
* the whole screen ( all monitors ) .
*/
gboolean
meta_window_is_screen_sized ( MetaWindow * window )
{
MetaRectangle window_rect ;
int screen_width , screen_height ;
2017-08-26 12:37:29 -04:00
meta_display_get_size ( window - > display , & screen_width , & screen_height ) ;
2013-11-19 12:24:45 -05:00
meta_window_get_frame_rect ( window , & window_rect ) ;
2013-02-18 07:30:37 -05:00
if ( window_rect . x = = 0 & & window_rect . y = = 0 & &
window_rect . width = = screen_width & & window_rect . height = = screen_height )
return TRUE ;
return FALSE ;
}
2013-02-17 15:12:45 -05:00
/**
* meta_window_is_monitor_sized :
2013-02-18 08:19:28 -05:00
* @ window : a # MetaWindow
2013-02-17 15:12:45 -05:00
*
* Return value : % TRUE if the window is occupies an entire monitor or
* the whole screen .
*/
gboolean
meta_window_is_monitor_sized ( MetaWindow * window )
{
2017-09-25 14:09:31 -04:00
if ( ! window - > monitor )
return FALSE ;
2013-02-17 15:12:45 -05:00
if ( window - > fullscreen )
return TRUE ;
2013-02-18 07:30:37 -05:00
if ( meta_window_is_screen_sized ( window ) )
return TRUE ;
2013-02-17 15:12:45 -05:00
if ( window - > override_redirect )
{
MetaRectangle window_rect , monitor_rect ;
2013-11-19 12:24:45 -05:00
meta_window_get_frame_rect ( window , & window_rect ) ;
2017-08-26 15:22:34 -04:00
meta_display_get_monitor_geometry ( window - > display , window - > monitor - > number , & monitor_rect ) ;
2013-02-17 15:12:45 -05:00
if ( meta_rectangle_equal ( & window_rect , & monitor_rect ) )
return TRUE ;
}
return FALSE ;
}
2011-03-09 07:04:18 -05:00
/**
* meta_window_is_on_primary_monitor :
2013-02-15 13:42:08 -05:00
* @ window : a # MetaWindow
2011-03-09 07:04:18 -05:00
*
* Return value : % TRUE if the window is on the primary monitor
*/
gboolean
meta_window_is_on_primary_monitor ( MetaWindow * window )
{
2017-09-25 15:10:58 -04:00
g_return_val_if_fail ( window - > monitor , FALSE ) ;
2011-05-20 04:56:12 -04:00
return window - > monitor - > is_primary ;
2011-03-09 07:04:18 -05:00
}
2017-09-27 08:37:57 -04:00
static void
meta_window_get_tile_fraction ( MetaWindow * window ,
MetaTileMode tile_mode ,
double * fraction )
{
2017-06-11 21:13:03 -04:00
MetaWindow * tile_match ;
/* Make sure the tile match is up-to-date and matches the
* passed in mode rather than the current state
*/
tile_match = meta_window_find_tile_match ( window , tile_mode ) ;
2017-09-27 08:37:57 -04:00
if ( tile_mode = = META_TILE_NONE )
* fraction = - 1. ;
else if ( tile_mode = = META_TILE_MAXIMIZED )
* fraction = 1. ;
2017-06-11 21:13:03 -04:00
else if ( tile_match )
* fraction = 1. - tile_match - > tile_hfraction ;
2017-09-27 08:37:57 -04:00
else if ( META_WINDOW_TILED_SIDE_BY_SIDE ( window ) )
{
if ( window - > tile_mode ! = tile_mode )
* fraction = 1. - window - > tile_hfraction ;
else
* fraction = window - > tile_hfraction ;
}
else
* fraction = .5 ;
}
static void
meta_window_update_tile_fraction ( MetaWindow * window ,
int new_w ,
int new_h )
{
2017-06-11 21:13:03 -04:00
MetaWindow * tile_match = window - > tile_match ;
2017-09-27 08:37:57 -04:00
MetaRectangle work_area ;
2022-10-21 06:56:24 -04:00
MetaWindowDrag * window_drag ;
2017-09-27 08:37:57 -04:00
if ( ! META_WINDOW_TILED_SIDE_BY_SIDE ( window ) )
return ;
meta_window_get_work_area_for_monitor ( window ,
window - > tile_monitor_number ,
& work_area ) ;
window - > tile_hfraction = ( double ) new_w / work_area . width ;
2017-06-11 21:13:03 -04:00
2022-10-21 06:56:24 -04:00
window_drag =
meta_compositor_get_current_window_drag ( window - > display - > compositor ) ;
if ( tile_match & &
window_drag & &
meta_window_drag_get_window ( window_drag ) = = window )
2017-06-11 21:13:03 -04:00
meta_window_tile ( tile_match , tile_match - > tile_mode ) ;
2017-09-27 08:37:57 -04:00
}
2017-08-16 23:43:21 -04:00
static void
update_edge_constraints ( MetaWindow * window )
{
switch ( window - > tile_mode )
{
case META_TILE_NONE :
2018-10-24 08:24:22 -04:00
window - > edge_constraints . top = META_EDGE_CONSTRAINT_NONE ;
window - > edge_constraints . right = META_EDGE_CONSTRAINT_NONE ;
window - > edge_constraints . bottom = META_EDGE_CONSTRAINT_NONE ;
window - > edge_constraints . left = META_EDGE_CONSTRAINT_NONE ;
2017-08-16 23:43:21 -04:00
break ;
case META_TILE_MAXIMIZED :
2018-10-24 08:24:22 -04:00
window - > edge_constraints . top = META_EDGE_CONSTRAINT_MONITOR ;
window - > edge_constraints . right = META_EDGE_CONSTRAINT_MONITOR ;
window - > edge_constraints . bottom = META_EDGE_CONSTRAINT_MONITOR ;
window - > edge_constraints . left = META_EDGE_CONSTRAINT_MONITOR ;
2017-08-16 23:43:21 -04:00
break ;
case META_TILE_LEFT :
2018-10-24 08:24:22 -04:00
window - > edge_constraints . top = META_EDGE_CONSTRAINT_MONITOR ;
2017-08-16 23:43:21 -04:00
if ( window - > tile_match )
2018-10-24 08:24:22 -04:00
window - > edge_constraints . right = META_EDGE_CONSTRAINT_WINDOW ;
2017-08-16 23:43:21 -04:00
else
2018-10-24 08:24:22 -04:00
window - > edge_constraints . right = META_EDGE_CONSTRAINT_NONE ;
2017-08-16 23:43:21 -04:00
2018-10-24 08:24:22 -04:00
window - > edge_constraints . bottom = META_EDGE_CONSTRAINT_MONITOR ;
window - > edge_constraints . left = META_EDGE_CONSTRAINT_MONITOR ;
2017-08-16 23:43:21 -04:00
break ;
case META_TILE_RIGHT :
2018-10-24 08:24:22 -04:00
window - > edge_constraints . top = META_EDGE_CONSTRAINT_MONITOR ;
window - > edge_constraints . right = META_EDGE_CONSTRAINT_MONITOR ;
window - > edge_constraints . bottom = META_EDGE_CONSTRAINT_MONITOR ;
2017-08-16 23:43:21 -04:00
if ( window - > tile_match )
2018-10-24 08:24:22 -04:00
window - > edge_constraints . left = META_EDGE_CONSTRAINT_WINDOW ;
2017-08-16 23:43:21 -04:00
else
2018-10-24 08:24:22 -04:00
window - > edge_constraints . left = META_EDGE_CONSTRAINT_NONE ;
2017-08-16 23:43:21 -04:00
break ;
}
/* h/vmaximize also modify the edge constraints */
if ( window - > maximized_vertically )
{
2018-10-24 08:24:22 -04:00
window - > edge_constraints . top = META_EDGE_CONSTRAINT_MONITOR ;
window - > edge_constraints . bottom = META_EDGE_CONSTRAINT_MONITOR ;
2017-08-16 23:43:21 -04:00
}
if ( window - > maximized_horizontally )
{
2018-10-24 08:24:22 -04:00
window - > edge_constraints . right = META_EDGE_CONSTRAINT_MONITOR ;
window - > edge_constraints . left = META_EDGE_CONSTRAINT_MONITOR ;
2017-08-16 23:43:21 -04:00
}
}
2020-04-02 13:04:43 -04:00
void
meta_window_untile ( MetaWindow * window )
{
2022-10-14 15:56:10 -04:00
g_return_if_fail ( META_IS_WINDOW ( window ) ) ;
2020-04-02 13:04:43 -04:00
window - > tile_monitor_number =
window - > saved_maximize ? window - > monitor - > number
: - 1 ;
window - > tile_mode =
window - > saved_maximize ? META_TILE_MAXIMIZED
: META_TILE_NONE ;
if ( window - > saved_maximize )
meta_window_maximize ( window , META_MAXIMIZE_BOTH ) ;
else
meta_window_unmaximize ( window , META_MAXIMIZE_BOTH ) ;
}
2016-01-10 09:16:09 -05:00
void
2017-09-27 09:11:54 -04:00
meta_window_tile ( MetaWindow * window ,
MetaTileMode tile_mode )
2016-01-10 09:16:09 -05:00
{
MetaMaximizeFlags directions ;
2022-10-21 06:56:24 -04:00
MetaWindowDrag * window_drag ;
2016-01-10 09:16:09 -05:00
2022-10-14 15:56:10 -04:00
g_return_if_fail ( META_IS_WINDOW ( window ) ) ;
2017-09-27 08:37:57 -04:00
meta_window_get_tile_fraction ( window , tile_mode , & window - > tile_hfraction ) ;
2017-09-27 09:11:54 -04:00
window - > tile_mode = tile_mode ;
2016-01-10 09:16:09 -05:00
/* Don't do anything if no tiling is requested */
if ( window - > tile_mode = = META_TILE_NONE )
2019-11-01 08:40:04 -04:00
{
window - > tile_monitor_number = - 1 ;
return ;
}
2020-10-12 08:08:28 -04:00
else if ( window - > tile_monitor_number < 0 )
2020-04-02 13:05:21 -04:00
{
window - > tile_monitor_number = window - > monitor - > number ;
}
2016-01-10 09:16:09 -05:00
if ( window - > tile_mode = = META_TILE_MAXIMIZED )
directions = META_MAXIMIZE_BOTH ;
else
directions = META_MAXIMIZE_VERTICAL ;
meta_window_maximize_internal ( window , directions , NULL ) ;
2022-10-21 06:56:24 -04:00
window_drag =
meta_compositor_get_current_window_drag ( window - > display - > compositor ) ;
if ( ! window - > tile_match | |
! window_drag | |
window - > tile_match ! = meta_window_drag_get_window ( window_drag ) )
2022-11-07 16:48:57 -05:00
{
MetaRectangle old_frame_rect , old_buffer_rect ;
meta_window_get_frame_rect ( window , & old_frame_rect ) ;
meta_window_get_buffer_rect ( window , & old_buffer_rect ) ;
2016-09-24 15:47:35 -04:00
2022-11-07 16:48:57 -05:00
meta_compositor_size_change_window ( window - > display - > compositor , window ,
META_SIZE_CHANGE_MAXIMIZE ,
& old_frame_rect , & old_buffer_rect ) ;
}
2016-09-24 15:47:35 -04:00
2017-06-03 09:48:20 -04:00
meta_window_move_resize_internal ( window ,
( META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION |
2022-03-04 09:23:38 -05:00
META_MOVE_RESIZE_STATE_CHANGED |
META_MOVE_RESIZE_CONSTRAIN ) ,
2020-02-14 03:44:43 -05:00
META_GRAVITY_NORTH_WEST ,
2017-06-03 09:48:20 -04:00
window - > unconstrained_rect ) ;
2016-01-10 09:16:09 -05:00
}
2019-06-13 09:49:26 -04:00
MetaTileMode
meta_window_get_tile_mode ( MetaWindow * window )
{
return window - > tile_mode ;
}
2017-09-27 08:37:57 -04:00
void
meta_window_restore_tile ( MetaWindow * window ,
MetaTileMode mode ,
int width ,
int height )
{
meta_window_update_tile_fraction ( window , width , height ) ;
meta_window_tile ( window , mode ) ;
}
2016-01-10 09:16:08 -05:00
static gboolean
meta_window_can_tile_maximized ( MetaWindow * window )
2011-04-18 12:27:03 -04:00
{
2016-01-10 09:16:08 -05:00
return window - > has_maximize_func ;
}
2011-04-18 12:27:03 -04:00
2016-01-10 09:16:08 -05:00
gboolean
meta_window_can_tile_side_by_side ( MetaWindow * window )
{
int monitor ;
MetaRectangle tile_area ;
MetaRectangle client_rect ;
2010-06-24 14:41:28 -04:00
2016-01-10 09:16:08 -05:00
if ( ! meta_window_can_tile_maximized ( window ) )
return FALSE ;
2010-06-24 14:41:28 -04:00
2017-08-26 15:22:34 -04:00
monitor = meta_display_get_current_monitor ( window - > display ) ;
2016-01-10 09:16:08 -05:00
meta_window_get_work_area_for_monitor ( window , monitor , & tile_area ) ;
/* Do not allow tiling in portrait orientation */
if ( tile_area . height > tile_area . width )
return FALSE ;
tile_area . width / = 2 ;
meta_window_frame_rect_to_client_rect ( window , & tile_area , & client_rect ) ;
2010-06-24 14:41:28 -04:00
2016-01-10 09:16:08 -05:00
return client_rect . width > = window - > size_hints . min_width & &
client_rect . height > = window - > size_hints . min_height ;
2010-06-24 14:41:28 -04:00
}
2006-01-20 18:36:23 -05:00
static void
unmaximize_window_before_freeing ( MetaWindow * window )
{
meta_topic ( META_DEBUG_WINDOW_OPS ,
2020-10-02 11:47:22 -04:00
" Unmaximizing %s just before freeing " ,
2006-01-20 18:36:23 -05:00
window - > desc ) ;
window - > maximized_horizontally = FALSE ;
window - > maximized_vertically = FALSE ;
2006-10-01 17:59:09 -04:00
if ( window - > withdrawn ) /* See bug #137185 */
{
2016-01-10 09:16:09 -05:00
window - > rect = window - > saved_rect ;
2006-10-01 17:59:09 -04:00
set_net_wm_state ( window ) ;
}
2017-04-21 05:40:25 -04:00
# ifdef HAVE_WAYLAND
2017-08-26 15:43:17 -04:00
else if ( ! meta_is_wayland_compositor ( ) )
2006-10-01 17:59:09 -04:00
{
/* Do NOT update net_wm_state: this screen is closing,
* it likely will be managed by another window manager
* that will need the current _NET_WM_STATE atoms .
* Moreover , it will need to know the unmaximized geometry ,
* therefore move_resize the window to saved_rect here
* before closing it . */
2014-05-20 17:47:10 -04:00
meta_window_move_resize_frame ( window ,
FALSE ,
2016-01-10 09:16:09 -05:00
window - > saved_rect . x ,
window - > saved_rect . y ,
window - > saved_rect . width ,
window - > saved_rect . height ) ;
2006-10-01 17:59:09 -04:00
}
2017-08-26 15:43:17 -04:00
# endif
2006-01-20 18:36:23 -05:00
}
2022-10-20 13:29:48 -04:00
void
2020-01-04 16:03:53 -05:00
meta_window_maybe_apply_size_hints ( MetaWindow * window ,
MetaRectangle * target_rect )
{
meta_window_frame_rect_to_client_rect ( window , target_rect , target_rect ) ;
ensure_size_hints_satisfied ( target_rect , & window - > size_hints ) ;
meta_window_client_rect_to_frame_rect ( window , target_rect , target_rect ) ;
}
2015-07-01 01:46:31 -04:00
void
meta_window_unmaximize ( MetaWindow * window ,
MetaMaximizeFlags directions )
2001-06-07 01:18:10 -04:00
{
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
gboolean unmaximize_horizontally , unmaximize_vertically ;
2009-06-14 08:11:29 -04:00
2022-10-14 15:56:10 -04:00
g_return_if_fail ( META_IS_WINDOW ( window ) ) ;
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
/* At least one of the two directions ought to be set */
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
unmaximize_horizontally = directions & META_MAXIMIZE_HORIZONTAL ;
unmaximize_vertically = directions & META_MAXIMIZE_VERTICAL ;
g_assert ( unmaximize_horizontally | | unmaximize_vertically ) ;
2016-01-10 09:16:09 -05:00
if ( unmaximize_horizontally & & unmaximize_vertically )
window - > saved_maximize = FALSE ;
2016-01-10 09:16:09 -05:00
/* Only do something if the window isn't already maximized in the
* given direction ( s ) .
*/
if ( ( unmaximize_horizontally & & window - > maximized_horizontally ) | |
( unmaximize_vertically & & window - > maximized_vertically ) )
2015-07-01 01:36:23 -04:00
{
2015-07-01 01:46:31 -04:00
MetaRectangle * desired_rect ;
2007-04-03 23:07:26 -04:00
MetaRectangle target_rect ;
2012-03-12 12:09:17 -04:00
MetaRectangle work_area ;
2016-01-10 09:16:09 -05:00
MetaRectangle old_frame_rect , old_buffer_rect ;
2020-01-04 16:03:53 -05:00
gboolean has_target_size ;
2012-03-12 12:09:17 -04:00
meta_window_get_work_area_for_monitor ( window , window - > monitor - > number , & work_area ) ;
2016-01-10 09:16:09 -05:00
meta_window_get_frame_rect ( window , & old_frame_rect ) ;
meta_window_get_buffer_rect ( window , & old_buffer_rect ) ;
2017-09-27 08:53:54 -04:00
if ( unmaximize_vertically )
window - > tile_mode = META_TILE_NONE ;
2016-01-10 09:16:09 -05:00
meta_topic ( META_DEBUG_WINDOW_OPS ,
2020-10-02 11:47:22 -04:00
" Unmaximizing %s%s " ,
2016-01-10 09:16:09 -05:00
window - > desc ,
unmaximize_horizontally & & unmaximize_vertically ? " " :
unmaximize_horizontally ? " horizontally " :
unmaximize_vertically ? " vertically " : " BUGGGGG " ) ;
window - > maximized_horizontally =
window - > maximized_horizontally & & ! unmaximize_horizontally ;
window - > maximized_vertically =
window - > maximized_vertically & & ! unmaximize_vertically ;
2017-08-16 23:43:21 -04:00
/* Update the edge constraints */
update_edge_constraints ( window ) ;
2016-01-10 09:16:09 -05:00
/* recalc_features() will eventually clear the cached frame
* extents , but we need the correct frame extents in the code below ,
* so invalidate the old frame extents manually up front .
*/
meta_window_frame_size_changed ( window ) ;
2013-12-05 08:27:28 -05:00
2016-01-10 09:16:09 -05:00
desired_rect = & window - > saved_rect ;
2015-07-01 01:46:31 -04:00
2007-04-03 23:07:26 -04:00
/* Unmaximize to the saved_rect position in the direction(s)
* being unmaximized .
*/
2016-01-10 09:16:09 -05:00
target_rect = old_frame_rect ;
2012-03-12 12:09:17 -04:00
/* Avoid unmaximizing to "almost maximized" size when the previous size
* is greater then 80 % of the work area use MAX_UNMAXIMIZED_WINDOW_AREA of the work area as upper limit
* while maintaining the aspect ratio .
*/
if ( unmaximize_horizontally & & unmaximize_vertically & &
desired_rect - > width * desired_rect - > height > work_area . width * work_area . height * MAX_UNMAXIMIZED_WINDOW_AREA )
{
if ( desired_rect - > width > desired_rect - > height )
{
float aspect = ( float ) desired_rect - > height / ( float ) desired_rect - > width ;
2016-01-10 09:16:09 -05:00
desired_rect - > width = MAX ( work_area . width * sqrt ( MAX_UNMAXIMIZED_WINDOW_AREA ) , window - > size_hints . min_width ) ;
desired_rect - > height = MAX ( desired_rect - > width * aspect , window - > size_hints . min_height ) ;
2012-03-12 12:09:17 -04:00
}
else
{
float aspect = ( float ) desired_rect - > width / ( float ) desired_rect - > height ;
2016-01-10 09:16:09 -05:00
desired_rect - > height = MAX ( work_area . height * sqrt ( MAX_UNMAXIMIZED_WINDOW_AREA ) , window - > size_hints . min_height ) ;
desired_rect - > width = MAX ( desired_rect - > height * aspect , window - > size_hints . min_width ) ;
2012-03-12 12:09:17 -04:00
}
}
2016-01-10 09:16:09 -05:00
if ( unmaximize_horizontally )
{
target_rect . x = desired_rect - > x ;
target_rect . width = desired_rect - > width ;
}
if ( unmaximize_vertically )
{
target_rect . y = desired_rect - > y ;
target_rect . height = desired_rect - > height ;
}
2007-04-03 23:07:26 -04:00
2016-01-10 09:16:09 -05:00
/* Window's size hints may have changed while maximized, making
* saved_rect invalid . # 329152
2019-09-20 19:49:44 -04:00
* Do not enforce limits , if no previous ' saved_rect ' has been stored .
2016-01-10 09:16:09 -05:00
*/
2020-01-04 16:03:53 -05:00
has_target_size = ( target_rect . width > 0 & & target_rect . height > 0 ) ;
if ( has_target_size )
meta_window_maybe_apply_size_hints ( window , & target_rect ) ;
2016-01-10 09:16:09 -05:00
2016-09-26 10:30:54 -04:00
meta_compositor_size_change_window ( window - > display - > compositor , window ,
META_SIZE_CHANGE_UNMAXIMIZE ,
& old_frame_rect , & old_buffer_rect ) ;
2016-01-10 09:16:09 -05:00
meta_window_move_resize_internal ( window ,
( META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION |
2017-06-21 05:30:09 -04:00
META_MOVE_RESIZE_STATE_CHANGED |
META_MOVE_RESIZE_UNMAXIMIZE ) ,
2020-02-14 03:44:43 -05:00
META_GRAVITY_NORTH_WEST ,
2016-01-10 09:16:09 -05:00
target_rect ) ;
meta_window_recalc_features ( window ) ;
set_net_wm_state ( window ) ;
if ( ! window - > monitor - > in_fullscreen )
2017-08-26 15:10:38 -04:00
meta_display_queue_check_fullscreen ( window - > display ) ;
2001-06-04 02:17:52 -04:00
}
2016-01-10 09:16:09 -05:00
g_object_freeze_notify ( G_OBJECT ( window ) ) ;
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_MAXIMIZED_HORIZONTALLY ] ) ;
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_MAXIMIZED_VERTICALLY ] ) ;
g_object_thaw_notify ( G_OBJECT ( window ) ) ;
2001-06-02 00:14:18 -04:00
}
2003-06-27 10:49:56 -04:00
void
meta_window_make_above ( MetaWindow * window )
{
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2011-07-02 07:08:17 -04:00
meta_window_set_above ( window , TRUE ) ;
2003-06-27 10:49:56 -04:00
meta_window_raise ( window ) ;
}
void
meta_window_unmake_above ( MetaWindow * window )
{
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2011-07-02 07:08:17 -04:00
meta_window_set_above ( window , FALSE ) ;
2003-06-27 10:49:56 -04:00
meta_window_raise ( window ) ;
2011-07-02 07:08:17 -04:00
}
static void
meta_window_set_above ( MetaWindow * window ,
gboolean new_value )
{
new_value = new_value ! = FALSE ;
if ( new_value = = window - > wm_state_above )
return ;
window - > wm_state_above = new_value ;
2003-06-27 10:49:56 -04:00
meta_window_update_layer ( window ) ;
set_net_wm_state ( window ) ;
2013-11-15 17:37:50 -05:00
meta_window_frame_size_changed ( window ) ;
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_ABOVE ] ) ;
2003-06-27 10:49:56 -04:00
}
2002-02-23 17:58:02 -05:00
void
Fix several bugs with handling of fullscreen windows, causing them to not
2006-08-21 Elijah Newren <newren gmail com>
Fix several bugs with handling of fullscreen windows, causing them
to not actually be fullscreen. #343115 (and also #346927,
#350547, #351643, the recent additional WINE-related issue
mentioned on the mailing list, and probably others...)
* src/constraints.c (setup_constraint_info): if a window tries to
resize to fullscreen-size and it has a fullscreen function but
isn't actually marked as fullscreen then assist it by marking it
as such, (constrain_fully_onscreen, constrain_titlebar_visible):
ignore this constraint for fullscreen windows since such windows
have a separate specialized constraint
* src/stack.c (window_is_fullscreen_size, get_standalone_layer):
remove the old window_is_fullscreen_size() hack for detecting
windows to treat as fullscreen since it doesn't work well with the
new constraints framework (i.e. we needed a slightly different
hack)
* src/window.[ch] (meta_window_new_with_addrs): shuffle the order
of adding the window to the stack and moveresizing the window
since moveresizing can cause stack changes if the window's initial
size is fullscreen size, (meta_window_make_fullscreen,
meta_window_make_fullscreen_internal): split
meta_window_make_fullscreen() similar to meta_window_maximize() so
that constraints can make use of it
2006-08-21 14:08:05 -04:00
meta_window_make_fullscreen_internal ( MetaWindow * window )
2002-02-23 17:58:02 -05:00
{
if ( ! window - > fullscreen )
{
meta_topic ( META_DEBUG_WINDOW_OPS ,
2020-10-02 11:47:22 -04:00
" Fullscreening %s " , window - > desc ) ;
2002-08-10 15:04:55 -04:00
if ( window - > shaded )
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 13:27:24 -04:00
{
/* Shading sucks anyway; I'm not adding a timestamp argument
* to this function just for this niche usage & corner case .
*/
2008-12-18 07:41:56 -05:00
guint32 timestamp =
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 13:27:24 -04:00
meta_display_get_current_time_roundtrip ( window - > display ) ;
meta_window_unshade ( window , timestamp ) ;
}
2002-09-24 17:33:34 -04:00
2020-03-31 17:30:38 -04:00
window - > saved_rect_fullscreen = window - > rect ;
2008-12-18 07:41:56 -05:00
2002-02-23 17:58:02 -05:00
window - > fullscreen = TRUE ;
2017-08-26 13:03:51 -04:00
meta_stack_freeze ( window - > display - > stack ) ;
2008-12-18 07:41:56 -05:00
2002-02-23 17:58:02 -05:00
meta_window_raise ( window ) ;
2017-08-26 13:03:51 -04:00
meta_stack_thaw ( window - > display - > stack ) ;
2008-12-18 07:41:56 -05:00
2014-02-01 18:58:58 -05:00
meta_window_recalc_features ( window ) ;
Fix several bugs with handling of fullscreen windows, causing them to not
2006-08-21 Elijah Newren <newren gmail com>
Fix several bugs with handling of fullscreen windows, causing them
to not actually be fullscreen. #343115 (and also #346927,
#350547, #351643, the recent additional WINE-related issue
mentioned on the mailing list, and probably others...)
* src/constraints.c (setup_constraint_info): if a window tries to
resize to fullscreen-size and it has a fullscreen function but
isn't actually marked as fullscreen then assist it by marking it
as such, (constrain_fully_onscreen, constrain_titlebar_visible):
ignore this constraint for fullscreen windows since such windows
have a separate specialized constraint
* src/stack.c (window_is_fullscreen_size, get_standalone_layer):
remove the old window_is_fullscreen_size() hack for detecting
windows to treat as fullscreen since it doesn't work well with the
new constraints framework (i.e. we needed a slightly different
hack)
* src/window.[ch] (meta_window_new_with_addrs): shuffle the order
of adding the window to the stack and moveresizing the window
since moveresizing can cause stack changes if the window's initial
size is fullscreen size, (meta_window_make_fullscreen,
meta_window_make_fullscreen_internal): split
meta_window_make_fullscreen() similar to meta_window_maximize() so
that constraints can make use of it
2006-08-21 14:08:05 -04:00
set_net_wm_state ( window ) ;
2009-03-17 08:27:13 -04:00
2013-03-14 16:55:49 -04:00
/* For the auto-minimize feature, if we fail to get focus */
2017-08-26 15:10:38 -04:00
meta_display_queue_check_fullscreen ( window - > display ) ;
2013-03-14 16:55:49 -04:00
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_FULLSCREEN ] ) ;
Fix several bugs with handling of fullscreen windows, causing them to not
2006-08-21 Elijah Newren <newren gmail com>
Fix several bugs with handling of fullscreen windows, causing them
to not actually be fullscreen. #343115 (and also #346927,
#350547, #351643, the recent additional WINE-related issue
mentioned on the mailing list, and probably others...)
* src/constraints.c (setup_constraint_info): if a window tries to
resize to fullscreen-size and it has a fullscreen function but
isn't actually marked as fullscreen then assist it by marking it
as such, (constrain_fully_onscreen, constrain_titlebar_visible):
ignore this constraint for fullscreen windows since such windows
have a separate specialized constraint
* src/stack.c (window_is_fullscreen_size, get_standalone_layer):
remove the old window_is_fullscreen_size() hack for detecting
windows to treat as fullscreen since it doesn't work well with the
new constraints framework (i.e. we needed a slightly different
hack)
* src/window.[ch] (meta_window_new_with_addrs): shuffle the order
of adding the window to the stack and moveresizing the window
since moveresizing can cause stack changes if the window's initial
size is fullscreen size, (meta_window_make_fullscreen,
meta_window_make_fullscreen_internal): split
meta_window_make_fullscreen() similar to meta_window_maximize() so
that constraints can make use of it
2006-08-21 14:08:05 -04:00
}
}
void
meta_window_make_fullscreen ( MetaWindow * window )
{
2022-10-14 15:56:10 -04:00
g_return_if_fail ( META_IS_WINDOW ( window ) ) ;
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
Fix several bugs with handling of fullscreen windows, causing them to not
2006-08-21 Elijah Newren <newren gmail com>
Fix several bugs with handling of fullscreen windows, causing them
to not actually be fullscreen. #343115 (and also #346927,
#350547, #351643, the recent additional WINE-related issue
mentioned on the mailing list, and probably others...)
* src/constraints.c (setup_constraint_info): if a window tries to
resize to fullscreen-size and it has a fullscreen function but
isn't actually marked as fullscreen then assist it by marking it
as such, (constrain_fully_onscreen, constrain_titlebar_visible):
ignore this constraint for fullscreen windows since such windows
have a separate specialized constraint
* src/stack.c (window_is_fullscreen_size, get_standalone_layer):
remove the old window_is_fullscreen_size() hack for detecting
windows to treat as fullscreen since it doesn't work well with the
new constraints framework (i.e. we needed a slightly different
hack)
* src/window.[ch] (meta_window_new_with_addrs): shuffle the order
of adding the window to the stack and moveresizing the window
since moveresizing can cause stack changes if the window's initial
size is fullscreen size, (meta_window_make_fullscreen,
meta_window_make_fullscreen_internal): split
meta_window_make_fullscreen() similar to meta_window_maximize() so
that constraints can make use of it
2006-08-21 14:08:05 -04:00
if ( ! window - > fullscreen )
{
2013-09-01 16:04:19 -04:00
MetaRectangle old_frame_rect , old_buffer_rect ;
meta_window_get_frame_rect ( window , & old_frame_rect ) ;
meta_window_get_buffer_rect ( window , & old_buffer_rect ) ;
2014-12-15 16:44:22 -05:00
2016-09-26 10:30:54 -04:00
meta_compositor_size_change_window ( window - > display - > compositor ,
window , META_SIZE_CHANGE_FULLSCREEN ,
& old_frame_rect , & old_buffer_rect ) ;
2013-09-01 16:04:19 -04:00
meta_window_make_fullscreen_internal ( window ) ;
2014-12-15 16:44:22 -05:00
meta_window_move_resize_internal ( window ,
2013-09-01 16:04:19 -04:00
( META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION |
2022-03-04 09:23:38 -05:00
META_MOVE_RESIZE_STATE_CHANGED |
META_MOVE_RESIZE_CONSTRAIN ) ,
2020-02-14 03:44:43 -05:00
META_GRAVITY_NORTH_WEST ,
2014-12-15 16:44:22 -05:00
window - > unconstrained_rect ) ;
2002-02-23 17:58:02 -05:00
}
}
void
meta_window_unmake_fullscreen ( MetaWindow * window )
{
2022-10-14 15:56:10 -04:00
g_return_if_fail ( META_IS_WINDOW ( window ) ) ;
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2002-02-23 17:58:02 -05:00
if ( window - > fullscreen )
{
2013-09-01 16:04:19 -04:00
MetaRectangle old_frame_rect , old_buffer_rect , target_rect ;
2020-01-04 16:03:53 -05:00
gboolean has_target_size ;
2007-04-04 17:54:56 -04:00
2002-02-23 17:58:02 -05:00
meta_topic ( META_DEBUG_WINDOW_OPS ,
2020-10-02 11:47:22 -04:00
" Unfullscreening %s " , window - > desc ) ;
2008-12-18 07:41:56 -05:00
2002-02-23 17:58:02 -05:00
window - > fullscreen = FALSE ;
2020-03-31 17:30:38 -04:00
target_rect = window - > saved_rect_fullscreen ;
2007-04-04 17:54:56 -04:00
2015-06-23 20:05:27 -04:00
meta_window_frame_size_changed ( window ) ;
2013-09-01 16:04:19 -04:00
meta_window_get_frame_rect ( window , & old_frame_rect ) ;
meta_window_get_buffer_rect ( window , & old_buffer_rect ) ;
2015-06-23 20:05:27 -04:00
2007-04-04 17:54:56 -04:00
/* Window's size hints may have changed while maximized, making
* saved_rect invalid . # 329152
2019-09-20 19:49:44 -04:00
* Do not enforce limits , if no previous ' saved_rect ' has been stored .
2007-04-04 17:54:56 -04:00
*/
2020-01-04 16:03:53 -05:00
has_target_size = ( target_rect . width > 0 & & target_rect . height > 0 ) ;
if ( has_target_size )
meta_window_maybe_apply_size_hints ( window , & target_rect ) ;
2002-02-23 17:58:02 -05:00
2011-10-17 14:56:56 -04:00
/* Need to update window->has_resize_func before we move_resize()
*/
2014-02-01 18:58:58 -05:00
meta_window_recalc_features ( window ) ;
2011-10-17 14:56:56 -04:00
set_net_wm_state ( window ) ;
2016-09-26 10:30:54 -04:00
meta_compositor_size_change_window ( window - > display - > compositor ,
window , META_SIZE_CHANGE_UNFULLSCREEN ,
& old_frame_rect , & old_buffer_rect ) ;
2014-12-15 16:44:22 -05:00
meta_window_move_resize_internal ( window ,
2013-09-01 16:04:19 -04:00
( META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION |
2019-06-13 04:35:35 -04:00
META_MOVE_RESIZE_STATE_CHANGED |
META_MOVE_RESIZE_UNFULLSCREEN ) ,
2020-02-14 03:44:43 -05:00
META_GRAVITY_NORTH_WEST ,
2014-12-15 16:44:22 -05:00
target_rect ) ;
2002-02-23 17:58:02 -05:00
2017-08-26 15:10:38 -04:00
meta_display_queue_check_fullscreen ( window - > display ) ;
2008-12-18 07:41:56 -05:00
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_FULLSCREEN ] ) ;
2002-02-23 17:58:02 -05:00
}
}
2016-11-29 04:50:17 -05:00
static void
meta_window_clear_fullscreen_monitors ( MetaWindow * window )
2008-11-16 21:57:20 -05:00
{
2016-11-29 04:50:17 -05:00
window - > fullscreen_monitors . top = NULL ;
window - > fullscreen_monitors . bottom = NULL ;
window - > fullscreen_monitors . left = NULL ;
window - > fullscreen_monitors . right = NULL ;
}
2016-11-28 07:11:24 -05:00
2016-11-29 04:50:17 -05:00
void
meta_window_update_fullscreen_monitors ( MetaWindow * window ,
MetaLogicalMonitor * top ,
MetaLogicalMonitor * bottom ,
MetaLogicalMonitor * left ,
MetaLogicalMonitor * right )
{
if ( top & & bottom & & left & & right )
2008-11-16 21:57:20 -05:00
{
2016-11-29 04:50:17 -05:00
window - > fullscreen_monitors . top = top ;
window - > fullscreen_monitors . bottom = bottom ;
window - > fullscreen_monitors . left = left ;
window - > fullscreen_monitors . right = right ;
2008-11-16 21:57:20 -05:00
}
else
{
2016-11-29 04:50:17 -05:00
meta_window_clear_fullscreen_monitors ( window ) ;
2008-11-16 21:57:20 -05:00
}
if ( window - > fullscreen )
{
meta_window_queue ( window , META_QUEUE_MOVE_RESIZE ) ;
}
}
2016-11-29 04:50:17 -05:00
gboolean
meta_window_has_fullscreen_monitors ( MetaWindow * window )
{
return window - > fullscreen_monitors . top ! = NULL ;
}
2019-08-22 04:55:17 -04:00
void
meta_window_adjust_fullscreen_monitor_rect ( MetaWindow * window ,
MetaRectangle * monitor_rect )
{
MetaWindowClass * window_class = META_WINDOW_GET_CLASS ( window ) ;
if ( window_class - > adjust_fullscreen_monitor_rect )
window_class - > adjust_fullscreen_monitor_rect ( window , monitor_rect ) ;
}
2001-06-02 21:33:27 -04:00
void
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 13:27:24 -04:00
meta_window_shade ( MetaWindow * window ,
guint32 timestamp )
2001-06-02 21:33:27 -04:00
{
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2002-02-07 22:34:26 -05:00
meta_topic ( META_DEBUG_WINDOW_OPS ,
2020-10-02 11:47:22 -04:00
" Shading %s " , window - > desc ) ;
2001-06-07 22:17:48 -04:00
if ( ! window - > shaded )
2008-12-18 07:41:56 -05:00
{
2001-08-06 00:43:31 -04:00
window - > shaded = TRUE ;
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
meta_window_queue ( window , META_QUEUE_MOVE_RESIZE | META_QUEUE_CALC_SHOWING ) ;
2013-11-15 17:37:50 -05:00
meta_window_frame_size_changed ( window ) ;
2001-06-10 23:24:20 -04:00
2002-01-03 18:28:19 -05:00
/* After queuing the calc showing, since _focus flushes it,
* and we need to focus the frame
*/
meta_topic ( META_DEBUG_FOCUS ,
2020-10-02 11:47:22 -04:00
" Re-focusing window %s after shading it " ,
2002-01-03 18:28:19 -05:00
window - > desc ) ;
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 13:27:24 -04:00
meta_window_focus ( window , timestamp ) ;
2008-12-18 07:41:56 -05:00
2001-06-10 23:24:20 -04:00
set_net_wm_state ( window ) ;
2001-06-02 21:33:27 -04:00
}
}
2001-06-06 00:47:37 -04:00
void
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 13:27:24 -04:00
meta_window_unshade ( MetaWindow * window ,
guint32 timestamp )
2001-06-06 00:47:37 -04:00
{
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2002-02-07 22:34:26 -05:00
meta_topic ( META_DEBUG_WINDOW_OPS ,
2020-10-02 11:47:22 -04:00
" Unshading %s " , window - > desc ) ;
2001-06-07 22:17:48 -04:00
if ( window - > shaded )
{
window - > shaded = FALSE ;
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
meta_window_queue ( window , META_QUEUE_MOVE_RESIZE | META_QUEUE_CALC_SHOWING ) ;
2013-11-15 17:37:50 -05:00
meta_window_frame_size_changed ( window ) ;
2002-01-03 18:28:19 -05:00
2001-06-09 17:58:30 -04:00
/* focus the window */
2002-01-03 18:28:19 -05:00
meta_topic ( META_DEBUG_FOCUS ,
2020-10-02 11:47:22 -04:00
" Focusing window %s after unshading it " ,
2002-01-03 18:28:19 -05:00
window - > desc ) ;
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 13:27:24 -04:00
meta_window_focus ( window , timestamp ) ;
2001-06-10 23:24:20 -04:00
set_net_wm_state ( window ) ;
}
}
2003-03-17 01:36:39 -05:00
static gboolean
unminimize_func ( MetaWindow * window ,
void * data )
{
meta_window_unminimize ( window ) ;
return TRUE ;
}
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
static void
unminimize_window_and_all_transient_parents ( MetaWindow * window )
{
2003-05-18 13:16:03 -04:00
meta_window_unminimize ( window ) ;
2003-03-17 01:36:39 -05:00
meta_window_foreach_ancestor ( window , unminimize_func , NULL ) ;
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
}
2014-01-23 16:33:53 -05:00
void
meta_window_activate_full ( MetaWindow * window ,
guint32 timestamp ,
MetaClientType source_indication ,
MetaWorkspace * workspace )
2001-10-29 02:00:46 -05:00
{
2017-08-27 15:02:40 -04:00
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
2014-04-11 07:52:55 -04:00
gboolean allow_workspace_switch ;
2019-05-03 14:10:47 -04:00
if ( window - > unmanaging )
{
g_warning ( " Trying to activate unmanaged window '%s' " , window - > desc ) ;
return ;
}
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
meta_topic ( META_DEBUG_FOCUS ,
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
" _NET_ACTIVE_WINDOW message sent for %s at time %u "
2020-10-02 11:47:22 -04:00
" by client type %u. " ,
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
window - > desc , timestamp , source_indication ) ;
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
2014-04-11 07:52:55 -04:00
allow_workspace_switch = ( timestamp ! = 0 ) ;
2014-04-11 13:05:20 -04:00
if ( timestamp ! = 0 & &
XSERVER_TIME_IS_BEFORE ( timestamp , window - > display - > last_user_time ) )
2005-02-06 11:52:26 -05:00
{
meta_topic ( META_DEBUG_FOCUS ,
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
" last_user_time (%u) is more recent; ignoring "
2020-10-02 11:47:22 -04:00
" _NET_ACTIVE_WINDOW message. " ,
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
window - > display - > last_user_time ) ;
2006-03-29 13:43:22 -05:00
meta_window_set_demands_attention ( window ) ;
2005-02-06 11:52:26 -05:00
return ;
}
2006-01-10 00:44:40 -05:00
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 13:27:24 -04:00
if ( timestamp = = 0 )
2014-04-11 13:05:20 -04:00
timestamp = meta_display_get_current_time_roundtrip ( window - > display ) ;
2005-02-08 22:15:11 -05:00
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
meta_window_set_user_time ( window , timestamp ) ;
2004-08-07 20:02:02 -04:00
2002-04-28 00:52:26 -04:00
/* disable show desktop mode unless we're a desktop component */
2003-05-16 17:59:08 -04:00
maybe_leave_show_desktop_mode ( window ) ;
2008-12-18 07:41:56 -05:00
2006-08-07 14:08:27 -04:00
/* Get window on current or given workspace */
if ( workspace = = NULL )
2017-08-27 15:02:40 -04:00
workspace = workspace_manager - > active_workspace ;
2008-12-21 00:35:30 -05:00
2009-03-17 08:27:13 -04:00
/* For non-transient windows, we just set up a pulsing indicator,
2008-12-21 00:35:30 -05:00
rather than move windows or workspaces .
See http : //bugzilla.gnome.org/show_bug.cgi?id=482354 */
2013-09-16 08:44:37 -04:00
if ( window - > transient_for = = NULL & &
2014-04-11 07:52:55 -04:00
! allow_workspace_switch & &
2008-12-21 00:35:30 -05:00
! meta_window_located_on_workspace ( window , workspace ) )
{
meta_window_set_demands_attention ( window ) ;
/* We've marked it as demanding, don't need to do anything else. */
return ;
}
2013-09-16 08:44:37 -04:00
else if ( window - > transient_for ! = NULL )
2008-12-21 00:35:30 -05:00
{
2009-03-17 08:27:13 -04:00
/* Move transients to current workspace - preference dialogs should appear over
2008-12-21 00:35:30 -05:00
the source window . */
2014-04-11 07:52:55 -04:00
meta_window_change_workspace ( window , workspace ) ;
2008-12-21 00:35:30 -05:00
}
2008-12-18 07:41:56 -05:00
2002-02-08 01:50:09 -05:00
if ( window - > shaded )
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 13:27:24 -04:00
meta_window_unshade ( window , timestamp ) ;
2001-10-29 02:00:46 -05:00
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
unminimize_window_and_all_transient_parents ( window ) ;
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 14:35:03 -05:00
if ( meta_prefs_get_raise_on_click ( ) | |
source_indication = = META_CLIENT_TYPE_PAGER )
meta_window_raise ( window ) ;
2005-07-23 21:13:41 -04:00
meta_topic ( META_DEBUG_FOCUS ,
2020-10-02 11:47:22 -04:00
" Focusing window %s due to activation " ,
2005-07-23 21:13:41 -04:00
window - > desc ) ;
2014-08-16 13:22:05 -04:00
2014-04-11 07:52:55 -04:00
if ( meta_window_located_on_workspace ( window , workspace ) )
meta_window_focus ( window , timestamp ) ;
else
meta_workspace_activate_with_focus ( window - > workspace , window , timestamp ) ;
window: Check aliveness a bit less aggressively
Currently we check whether a window is alive everytime it's focused.
This means that an application that doesn't respond to the check-alive
event during startup always showing the "application froze" dialog,
without the user ever trying to interact with it.
An example where this tends to to happen is with games, and for this
particular scenario, it's purely an annoyance, as I never tried to
interact with the game window in the first place, so I don't care that
it's not responding - it's loading.
To avoid these unnecessary particular "app-is-frozen" popups, remove the
alive check from the focus function, and instead move it back to the
"meta_window_activate_full()" call. To also trigger it slightly more
often, also add it to the path that triggers the window focus when a
user actively clicks on the window.
This means that we currently check whether a window is alive on:
* Any time the window is activated. This means e.g. alt-tab or
selecting the window in the overview.
* The user clicks on the window.
Note that the second only works for an already focused window on
Wayland, as on X11, we don't refocus it. This particular case isn't
changed with this commit, as we didn't call meta_window_focus() to begin
with here.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1182
2020-04-07 04:39:10 -04:00
meta_window_check_alive ( window , timestamp ) ;
2001-10-29 02:00:46 -05:00
}
2001-06-10 23:24:20 -04:00
2006-01-10 00:44:40 -05:00
/* This function exists since most of the functionality in window_activate
Comprehensively rename to Mutter
Code:
All references in the code not related to themes, keybindings, or
GConf were changed from 'metacity' to 'mutter'. This includes, among other
things, strings, comments, the atoms used in the message protocol, and
the envvars used for debugging. The GConf schema file was reduced to
the 3 settings new to mutter.
The overall version was brought up to 2.27 to match current gnome.
Structure:
All files named '*metacity*' were renamed '*mutter*' with appropriate
changes in the automake system. Files removed are
doc/creating_themes, src/themes, doc/metacity-theme.dtd,
metacity.doap. These files will eventually end up in an external
gnome-wm-data module.
Installation location:
On the filesystem the mutter-plugindir was change from
$(libdir)/metacity/plugins/clutter to just $(libdir)/mutter/plugins.
The mutter-plugins.pc.in reflects these changes.
Note:
mutter.desktop.in and mutter-wm.desktop both continue to have
X-GNOME-WMSettingsModule=metacity set. This allows
gnome-control-center to continue using libmetacity.so for
configuration. This is fine since most the general keybindings and wm
settings are being read from /apps/metacity/* in gconf.
2009-06-10 06:29:20 -04:00
* is useful for Mutter , but Mutter shouldn ' t need to specify a client
2006-01-10 00:44:40 -05:00
* type for itself . ; - )
*/
void
meta_window_activate ( MetaWindow * window ,
guint32 timestamp )
{
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2006-01-10 00:44:40 -05:00
/* We're not really a pager, but the behavior we want is the same as if
* we were such . If we change the pager behavior later , we could revisit
* this and just add extra flags to window_activate .
*/
2014-01-23 16:33:53 -05:00
meta_window_activate_full ( window , timestamp , META_CLIENT_TYPE_PAGER , NULL ) ;
2006-08-07 14:08:27 -04:00
}
void
meta_window_activate_with_workspace ( MetaWindow * window ,
guint32 timestamp ,
MetaWorkspace * workspace )
{
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2014-01-23 16:33:53 -05:00
meta_window_activate_full ( window , timestamp , META_CLIENT_TYPE_APPLICATION , workspace ) ;
2006-01-10 00:44:40 -05:00
}
2011-06-13 17:53:23 -04:00
/**
* meta_window_updates_are_frozen :
* @ window : a # MetaWindow
*
* Gets whether the compositor should be updating the window contents ;
* window content updates may be frozen at client request by setting
2014-05-01 15:04:09 -04:00
* an odd value in the extended _NET_WM_SYNC_REQUEST_COUNTER counter
2011-06-13 17:53:23 -04:00
* by the window manager during a resize operation while waiting for
* the client to redraw .
*
* Return value : % TRUE if updates are currently frozen
*/
gboolean
meta_window_updates_are_frozen ( MetaWindow * window )
{
2018-09-14 13:03:38 -04:00
return META_WINDOW_GET_CLASS ( window ) - > are_updates_frozen ( window ) ;
2011-06-13 17:53:23 -04:00
}
2018-08-22 15:54:16 -04:00
static void
meta_window_reposition ( MetaWindow * window )
{
meta_window_move_resize_internal ( window ,
( META_MOVE_RESIZE_MOVE_ACTION |
2022-03-04 09:23:38 -05:00
META_MOVE_RESIZE_RESIZE_ACTION |
META_MOVE_RESIZE_CONSTRAIN ) ,
2020-02-14 03:44:43 -05:00
META_GRAVITY_NORTH_WEST ,
2018-08-22 15:54:16 -04:00
window - > rect ) ;
}
2010-09-10 05:55:20 -04:00
static gboolean
2018-08-22 15:54:16 -04:00
maybe_move_attached_window ( MetaWindow * window ,
window: make determination of attached dialog windows more consistent
Different bits of code were using slightly different checks to test
whether a window was an attached dialog. Add a new
meta_window_is_attached_dialog(), and use that everywhere.
Also, freeze the is-attached status when the window is first shown,
rather than recomputing it each time the caller asks, since this could
cause problems if a window changes its type after it has already been
attached, etc. However, if an attached window's parent is destroyed,
or an attached window changes its transient-for, then fix things up by
destroying the old MetaWindow and creating a new one (causing
compositor unmap and map events to be fired off, allowing the display
of the window to be fixed up).
Remove some code in display.c that tried to fix existing windows if
the gconf setting changed, but which didn't actually do anything (at
least under gnome-shell). However, if 654643 was fixed then the new
behavior with this patch would be that changing the gconf setting
would affect new dialogs, but not existing ones.
https://bugzilla.gnome.org/show_bug.cgi?id=646761
2011-04-05 10:14:52 -04:00
void * data )
2010-09-10 05:55:20 -04:00
{
2019-03-15 12:10:38 -04:00
if ( window - > hidden )
2019-05-24 04:52:40 -04:00
return G_SOURCE_CONTINUE ;
2019-03-15 12:10:38 -04:00
2018-08-22 15:54:16 -04:00
if ( meta_window_is_attached_dialog ( window ) | |
meta_window_get_placement_rule ( window ) )
meta_window_reposition ( window ) ;
2010-09-10 05:55:20 -04:00
2019-05-24 04:52:40 -04:00
return G_SOURCE_CONTINUE ;
2010-09-10 05:55:20 -04:00
}
2011-02-28 09:21:35 -05:00
/**
* meta_window_get_monitor :
* @ window : a # MetaWindow
*
* Gets index of the monitor that this window is on .
*
2017-10-10 12:39:40 -04:00
* Return Value : The index of the monitor in the screens monitor list , or - 1
* if the window has been recently unmanaged and does not have a monitor .
2011-02-28 09:21:35 -05:00
*/
int
meta_window_get_monitor ( MetaWindow * window )
{
2017-10-10 12:39:40 -04:00
if ( ! window - > monitor )
return - 1 ;
2011-02-28 09:21:35 -05:00
return window - > monitor - > number ;
}
2016-12-02 02:38:08 -05:00
MetaLogicalMonitor *
meta_window_get_main_logical_monitor ( MetaWindow * window )
{
return window - > monitor ;
}
2016-11-25 01:31:38 -05:00
static MetaLogicalMonitor *
2014-07-01 13:23:05 -04:00
find_monitor_by_winsys_id ( MetaWindow * window ,
2018-10-17 10:55:18 -04:00
uint64_t winsys_id )
2014-06-13 16:28:26 -04:00
{
2022-05-27 16:27:07 -04:00
MetaBackend * backend = backend_from_window ( window ) ;
2016-11-28 07:11:24 -05:00
MetaMonitorManager * monitor_manager =
meta_backend_get_monitor_manager ( backend ) ;
2016-12-02 03:00:03 -05:00
GList * logical_monitors , * l ;
2016-11-28 07:11:24 -05:00
logical_monitors =
2016-12-02 03:00:03 -05:00
meta_monitor_manager_get_logical_monitors ( monitor_manager ) ;
2014-06-13 16:28:26 -04:00
2016-12-02 03:00:03 -05:00
for ( l = logical_monitors ; l ; l = l - > next )
2014-06-13 16:28:26 -04:00
{
2016-12-02 03:00:03 -05:00
MetaLogicalMonitor * logical_monitor = l - > data ;
2014-06-13 16:28:26 -04:00
2016-11-25 01:31:38 -05:00
if ( logical_monitor - > winsys_id = = winsys_id )
return logical_monitor ;
2014-06-13 16:28:26 -04:00
}
return NULL ;
}
2022-08-03 16:59:16 -04:00
MetaLogicalMonitor *
meta_window_find_monitor_from_id ( MetaWindow * window )
{
MetaContext * context = meta_display_get_context ( window - > display ) ;
MetaBackend * backend = meta_context_get_backend ( context ) ;
MetaMonitorManager * monitor_manager =
meta_backend_get_monitor_manager ( backend ) ;
MetaLogicalMonitor * old_monitor = window - > monitor ;
MetaLogicalMonitor * new_monitor ;
new_monitor = find_monitor_by_winsys_id ( window ,
window - > preferred_output_winsys_id ) ;
if ( old_monitor & & ! new_monitor )
new_monitor = find_monitor_by_winsys_id ( window , old_monitor - > winsys_id ) ;
if ( ! new_monitor )
{
new_monitor =
meta_monitor_manager_get_primary_logical_monitor ( monitor_manager ) ;
}
return new_monitor ;
}
2011-05-20 04:56:12 -04:00
/* This is called when the monitor setup has changed. The window->monitor
* reference is still " valid " , but refer to the previous monitor setup */
2011-02-25 10:37:05 -05:00
void
2011-05-20 04:56:12 -04:00
meta_window_update_for_monitors_changed ( MetaWindow * window )
{
2022-08-03 16:58:11 -04:00
MetaContext * context = meta_display_get_context ( window - > display ) ;
MetaBackend * backend = meta_context_get_backend ( context ) ;
2016-11-28 07:11:24 -05:00
MetaMonitorManager * monitor_manager =
meta_backend_get_monitor_manager ( backend ) ;
2016-11-25 01:31:38 -05:00
const MetaLogicalMonitor * old , * new ;
2011-05-20 04:56:12 -04:00
2016-11-29 04:50:17 -05:00
if ( meta_window_has_fullscreen_monitors ( window ) )
meta_window_clear_fullscreen_monitors ( window ) ;
2016-11-29 03:13:21 -05:00
2015-10-24 12:46:12 -04:00
if ( window - > override_redirect | | window - > type = = META_WINDOW_DESKTOP )
2013-06-24 03:49:44 -04:00
{
2018-08-24 06:54:50 -04:00
meta_window_update_monitor ( window ,
2018-08-24 06:56:31 -04:00
META_WINDOW_UPDATE_MONITOR_FLAGS_FORCE ) ;
2019-11-11 05:01:43 -05:00
goto out ;
2013-06-24 03:49:44 -04:00
}
2011-05-20 04:56:12 -04:00
old = window - > monitor ;
2022-08-03 16:59:16 -04:00
new = meta_window_find_monitor_from_id ( window ) ;
2011-05-20 04:56:12 -04:00
2019-11-01 08:18:12 -04:00
if ( window - > tile_mode ! = META_TILE_NONE )
2017-08-18 02:21:11 -04:00
{
2019-11-01 08:18:12 -04:00
if ( new )
2017-08-18 02:21:11 -04:00
window - > tile_monitor_number = new - > number ;
2019-11-01 08:18:12 -04:00
else
window - > tile_monitor_number = - 1 ;
}
2017-08-18 02:21:11 -04:00
2019-11-01 08:18:12 -04:00
if ( new & & old )
{
2017-08-18 02:21:11 -04:00
/* This will eventually reach meta_window_update_monitor that
* will send leave / enter - monitor events . The old ! = new monitor
* check will always fail ( due to the new logical_monitors set ) so
* we will always send the events , even if the new and old monitor
* index is the same . That is right , since the enumeration of the
* monitors changed and the same index could be refereing
* to a different monitor . */
meta_window_move_between_rects ( window ,
2018-11-06 07:35:31 -05:00
META_MOVE_RESIZE_FORCE_UPDATE_MONITOR ,
2017-08-18 02:21:11 -04:00
& old - > rect ,
& new - > rect ) ;
}
else
{
2018-08-24 06:54:50 -04:00
meta_window_update_monitor ( window ,
2018-08-24 06:56:31 -04:00
META_WINDOW_UPDATE_MONITOR_FLAGS_FORCE ) ;
2017-08-18 02:21:11 -04:00
}
2019-11-11 05:01:43 -05:00
out :
g_assert ( ! window - > monitor | |
g_list_find ( meta_monitor_manager_get_logical_monitors ( monitor_manager ) ,
window - > monitor ) ) ;
2011-05-20 04:56:12 -04:00
}
2014-03-18 10:36:00 -04:00
void
2018-08-24 06:54:50 -04:00
meta_window_update_monitor ( MetaWindow * window ,
MetaWindowUpdateMonitorFlags flags )
2011-02-25 10:37:05 -05:00
{
2017-08-27 15:02:40 -04:00
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
2016-11-25 01:31:38 -05:00
const MetaLogicalMonitor * old ;
2011-02-28 07:48:28 -05:00
old = window - > monitor ;
2018-08-24 06:54:50 -04:00
META_WINDOW_GET_CLASS ( window ) - > update_main_monitor ( window , flags ) ;
2011-02-28 07:48:28 -05:00
if ( old ! = window - > monitor )
{
2014-08-16 13:22:05 -04:00
meta_window_on_all_workspaces_changed ( window ) ;
2011-02-28 07:48:28 -05:00
2014-06-20 12:06:40 -04:00
/* If workspaces only on primary and we moved back to primary due to a user action,
* ensure that the window is now in that workspace . We do this because while
* the window is on a non - primary monitor it is always visible , so it would be
* very jarring if it disappeared when it crossed the monitor border .
2011-02-28 07:48:28 -05:00
* The one time we want it to both change to the primary monitor and a non - active
* workspace is when dropping the window on some other workspace thumbnail directly .
* That should be handled by explicitly moving the window before changing the
2014-06-20 12:06:40 -04:00
* workspace .
2011-02-28 07:48:28 -05:00
*/
2018-08-24 06:54:50 -04:00
if ( meta_prefs_get_workspaces_only_on_primary ( ) & &
flags & META_WINDOW_UPDATE_MONITOR_FLAGS_USER_OP & &
2011-02-28 07:48:28 -05:00
meta_window_is_on_primary_monitor ( window ) & &
2017-08-27 15:02:40 -04:00
workspace_manager - > active_workspace ! = window - > workspace )
meta_window_change_workspace ( window , workspace_manager - > active_workspace ) ;
2011-02-28 15:26:11 -05:00
2015-03-02 22:13:05 -05:00
meta_window_main_monitor_changed ( window , old ) ;
2012-03-12 23:18:03 -04:00
/* If we're changing monitors, we need to update the has_maximize_func flag,
* as the working area has changed . */
2014-02-01 18:58:58 -05:00
meta_window_recalc_features ( window ) ;
2022-03-04 12:48:31 -05:00
meta_display_queue_check_fullscreen ( window - > display ) ;
2011-02-28 07:48:28 -05:00
}
2011-02-25 10:37:05 -05:00
}
2014-04-28 17:44:45 -04:00
void
2007-04-09 19:00:55 -04:00
meta_window_move_resize_internal ( MetaWindow * window ,
MetaMoveResizeFlags flags ,
2020-02-14 03:44:43 -05:00
MetaGravity gravity ,
2014-05-20 17:47:10 -04:00
MetaRectangle frame_rect )
2001-06-09 17:58:30 -04:00
{
2014-05-20 17:47:10 -04:00
/* The rectangle here that's passed in *always* in "frame rect"
* coordinates . That means the position of the frame ' s visible bounds ,
* with x and y being absolute ( root window ) coordinates .
*
* For an X11 framed window , the client window ' s server rectangle is
* inset from this rectangle by the frame ' s visible borders , and the
* frame window ' s server rectangle is outset by the invisible borders .
*
* For an X11 unframed window , the rectangle here directly matches
* the server ' s rectangle , since the visible and invisible borders
* are both 0.
*
* For an X11 CSD window , the client window ' s server rectangle is
* outset from this rectagle by the client - specified frame extents .
*
* For a Wayland window , this rectangle can simply be sent directly
* to the client .
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
*/
2014-05-20 17:47:10 -04:00
2017-08-27 15:02:40 -04:00
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
2013-02-15 21:27:00 -05:00
gboolean did_placement ;
2014-05-21 13:59:13 -04:00
MetaRectangle unconstrained_rect ;
MetaRectangle constrained_rect ;
2020-02-14 04:41:38 -05:00
MetaRectangle temporary_rect ;
2020-02-14 02:52:48 -05:00
int rel_x = 0 ;
int rel_y = 0 ;
2014-04-12 13:06:20 -04:00
MetaMoveResizeResultFlags result = 0 ;
2017-03-20 01:49:34 -04:00
gboolean moved_or_resized = FALSE ;
2018-08-24 06:54:50 -04:00
MetaWindowUpdateMonitorFlags update_monitor_flags ;
2008-12-18 07:41:56 -05:00
2009-06-15 18:25:07 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2013-09-03 06:00:29 -04:00
/* The action has to be a move, a resize or the wayland client
* acking our choice of size .
*/
2018-10-22 10:41:12 -04:00
g_assert ( flags & ( META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION |
META_MOVE_RESIZE_WAYLAND_FINISH_MOVE_RESIZE ) ) ;
2008-12-18 07:41:56 -05:00
2014-06-19 13:02:14 -04:00
did_placement = ! window - > placed & & window - > calc_placement ;
2002-05-29 00:14:15 -04:00
/* We don't need it in the idle queue anymore. */
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
meta_window_unqueue ( window , META_QUEUE_MOVE_RESIZE ) ;
2003-02-23 12:09:46 -05:00
2014-12-15 16:28:47 -05:00
if ( ( flags & META_MOVE_RESIZE_RESIZE_ACTION ) & & ( flags & META_MOVE_RESIZE_MOVE_ACTION ) )
2008-12-18 07:41:56 -05:00
{
2014-07-14 17:00:01 -04:00
/* We're both moving and resizing. Just use the passed in rect. */
unconstrained_rect = frame_rect ;
}
2014-12-15 16:28:47 -05:00
else if ( ( flags & META_MOVE_RESIZE_RESIZE_ACTION ) )
2014-07-14 17:00:01 -04:00
{
/* If this is only a resize, then ignore the position given in
* the parameters and instead calculate the new position from
* resizing the old rectangle with the given gravity . */
2014-05-20 17:47:10 -04:00
meta_rectangle_resize_with_gravity ( & window - > rect ,
2014-05-21 13:59:13 -04:00
& unconstrained_rect ,
2014-05-01 19:09:13 -04:00
gravity ,
2014-05-20 17:47:10 -04:00
frame_rect . width ,
frame_rect . height ) ;
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
}
2014-12-15 16:28:47 -05:00
else if ( ( flags & META_MOVE_RESIZE_MOVE_ACTION ) )
2014-05-21 08:41:32 -04:00
{
2014-07-14 17:00:01 -04:00
/* If this is only a move, then ignore the passed in size and
* just use the existing size of the window . */
unconstrained_rect . x = frame_rect . x ;
unconstrained_rect . y = frame_rect . y ;
2014-05-21 13:59:13 -04:00
unconstrained_rect . width = window - > rect . width ;
unconstrained_rect . height = window - > rect . height ;
2014-05-21 08:41:32 -04:00
}
2018-10-22 10:41:12 -04:00
else if ( ( flags & META_MOVE_RESIZE_WAYLAND_FINISH_MOVE_RESIZE ) )
2014-07-14 17:00:01 -04:00
{
/* This is a Wayland buffer acking our size. The new rect is
* just the existing one we have . Ignore the passed - in rect
* completely . */
unconstrained_rect = window - > rect ;
}
else
g_assert_not_reached ( ) ;
2014-05-21 08:41:32 -04:00
2014-05-21 13:59:13 -04:00
constrained_rect = unconstrained_rect ;
2020-02-14 04:41:38 -05:00
temporary_rect = window - > rect ;
2022-03-04 09:23:38 -05:00
if ( flags & META_MOVE_RESIZE_CONSTRAIN & & window - > monitor )
2013-09-03 06:00:29 -04:00
{
2014-05-01 19:20:26 -04:00
MetaRectangle old_rect ;
meta_window_get_frame_rect ( window , & old_rect ) ;
2013-09-03 06:00:29 -04:00
meta_window_constrain ( window ,
flags ,
gravity ,
& old_rect ,
2020-02-14 02:52:48 -05:00
& constrained_rect ,
2020-02-14 04:41:38 -05:00
& temporary_rect ,
2020-02-14 02:52:48 -05:00
& rel_x ,
& rel_y ) ;
}
else if ( window - > placement . rule )
{
2020-02-14 04:41:38 -05:00
rel_x = window - > placement . pending . rel_x ;
rel_y = window - > placement . pending . rel_y ;
2013-09-03 06:00:29 -04:00
}
2003-06-25 23:09:38 -04:00
2014-06-19 13:02:14 -04:00
/* If we did placement, then we need to save the position that the window
2022-01-28 18:49:50 -05:00
* was placed at to make sure that meta_window_update_layout ( ) places the
2014-06-19 13:02:14 -04:00
* window correctly .
*/
if ( did_placement )
{
2014-07-07 14:08:07 -04:00
unconstrained_rect . x = constrained_rect . x ;
unconstrained_rect . y = constrained_rect . y ;
2014-06-19 13:02:14 -04:00
}
2014-03-19 10:30:12 -04:00
/* Do the protocol-specific move/resize logic */
2020-02-14 02:52:48 -05:00
META_WINDOW_GET_CLASS ( window ) - > move_resize_internal ( window ,
gravity ,
unconstrained_rect ,
constrained_rect ,
2020-02-14 04:41:38 -05:00
temporary_rect ,
2020-02-14 02:52:48 -05:00
rel_x ,
rel_y ,
flags , & result ) ;
2001-06-09 23:17:15 -04:00
2014-03-19 10:30:12 -04:00
if ( result & META_MOVE_RESIZE_RESULT_MOVED )
2017-03-20 01:49:34 -04:00
{
moved_or_resized = TRUE ;
g_signal_emit ( window , window_signals [ POSITION_CHANGED ] , 0 ) ;
}
2013-12-06 15:39:24 -05:00
2014-03-19 10:30:12 -04:00
if ( result & META_MOVE_RESIZE_RESULT_RESIZED )
2001-09-10 22:57:05 -04:00
{
2017-03-20 01:49:34 -04:00
moved_or_resized = TRUE ;
g_signal_emit ( window , window_signals [ SIZE_CHANGED ] , 0 ) ;
}
2021-10-27 17:44:47 -04:00
/* Only update the stored size when requested but not when a
* ( potentially outdated ) request completes */
if ( ! ( flags & META_MOVE_RESIZE_WAYLAND_FINISH_MOVE_RESIZE ) | |
flags & META_MOVE_RESIZE_WAYLAND_CLIENT_RESIZE )
{
window - > unconstrained_rect = unconstrained_rect ;
}
2014-07-07 14:08:07 -04:00
2017-03-20 01:49:34 -04:00
if ( ( moved_or_resized | |
did_placement | |
window: Let implementations finish state changes
In the old, synchronous X.org world, we could assume that
a state change always meant a synchronizing the window
geometry right after. After firing an operation that
would change the window state, such as maximizing or
tiling the window,
With Wayland, however, this is not valid anymore, since
Wayland is asynchronous. In this scenario, we call
meta_window_move_resize_internal() twice: when the user
executes an state-changing operation, and when the server
ACKs this operation. This breaks the previous assumptions,
and as a consequence, it breaks the GNOME Shell animations
in Wayland.
The solution is giving the MetaWindow control over the time
when the window geometry is synchronized with the compositor.
That is done by introducing a new result flag. Wayland asks
for a compositor sync after receiving an ACK from the server,
while X11 asks for it right away.
Fixes #78
2018-04-17 22:42:33 -04:00
( result & META_MOVE_RESIZE_RESULT_STATE_CHANGED ) ! = 0 ) & &
2017-03-20 01:49:34 -04:00
window - > known_to_compositor )
{
meta_compositor_sync_window_geometry ( window - > display - > compositor ,
window ,
did_placement ) ;
2001-09-10 22:57:05 -04:00
}
2008-12-18 07:41:56 -05:00
2018-08-24 06:54:50 -04:00
update_monitor_flags = META_WINDOW_UPDATE_MONITOR_FLAGS_NONE ;
if ( flags & META_MOVE_RESIZE_USER_ACTION )
update_monitor_flags | = META_WINDOW_UPDATE_MONITOR_FLAGS_USER_OP ;
2018-11-06 07:35:31 -05:00
if ( flags & META_MOVE_RESIZE_FORCE_UPDATE_MONITOR )
update_monitor_flags | = META_WINDOW_UPDATE_MONITOR_FLAGS_FORCE ;
2018-08-24 06:54:50 -04:00
2017-08-18 02:21:11 -04:00
if ( window - > monitor )
{
2018-10-17 10:55:18 -04:00
uint64_t old_output_winsys_id ;
2014-06-13 16:28:26 -04:00
2017-08-18 02:21:11 -04:00
old_output_winsys_id = window - > monitor - > winsys_id ;
2011-02-25 10:37:05 -05:00
2018-08-24 06:54:50 -04:00
meta_window_update_monitor ( window , update_monitor_flags ) ;
2017-08-18 02:21:11 -04:00
if ( old_output_winsys_id ! = window - > monitor - > winsys_id & &
flags & META_MOVE_RESIZE_MOVE_ACTION & & flags & META_MOVE_RESIZE_USER_ACTION )
window - > preferred_output_winsys_id = window - > monitor - > winsys_id ;
}
else
{
2018-08-24 06:54:50 -04:00
meta_window_update_monitor ( window , update_monitor_flags ) ;
2017-08-18 02:21:11 -04:00
}
2014-06-13 16:28:26 -04:00
2014-03-20 18:00:55 -04:00
if ( ( result & META_MOVE_RESIZE_RESULT_FRAME_SHAPE_CHANGED ) & & window - > frame_bounds )
2011-03-22 15:36:12 -04:00
{
cairo_region_destroy ( window - > frame_bounds ) ;
window - > frame_bounds = NULL ;
}
2018-08-22 15:54:16 -04:00
meta_window_foreach_transient ( window , maybe_move_attached_window , NULL ) ;
2016-01-10 09:16:09 -05:00
2017-08-26 13:03:51 -04:00
meta_stack_update_window_tile_matches ( window - > display - > stack ,
2017-08-27 15:02:40 -04:00
workspace_manager - > active_workspace ) ;
2021-11-18 11:24:40 -05:00
if ( flags & META_MOVE_RESIZE_WAYLAND_CLIENT_RESIZE )
meta_window_queue ( window , META_QUEUE_MOVE_RESIZE ) ;
2001-06-07 22:17:48 -04:00
}
2011-03-09 10:01:44 -05:00
/**
* meta_window_move_frame :
* @ window : a # MetaWindow
* @ user_op : bool to indicate whether or not this is a user operation
* @ root_x_nw : desired x pos
* @ root_y_nw : desired y pos
*
* Moves the window to the desired location on window ' s assigned
* workspace , using the northwest edge of the frame as the reference ,
* instead of the actual window ' s origin , but only if a frame is present .
* Otherwise , acts identically to meta_window_move ( ) .
*/
void
2014-05-20 18:14:59 -04:00
meta_window_move_frame ( MetaWindow * window ,
gboolean user_op ,
int root_x_nw ,
int root_y_nw )
2011-03-09 10:01:44 -05:00
{
2014-05-21 08:46:18 -04:00
MetaMoveResizeFlags flags ;
2013-11-15 16:11:20 -05:00
MetaRectangle rect = { root_x_nw , root_y_nw , 0 , 0 } ;
2012-03-12 23:11:07 -04:00
2014-05-21 08:46:18 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2022-03-04 09:23:38 -05:00
flags = ( ( user_op ? META_MOVE_RESIZE_USER_ACTION : 0 ) |
META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_CONSTRAIN ) ;
2020-02-14 03:44:43 -05:00
meta_window_move_resize_internal ( window , flags , META_GRAVITY_NORTH_WEST , rect ) ;
2011-03-09 10:01:44 -05:00
}
2001-06-07 22:17:48 -04:00
2011-05-20 04:56:12 -04:00
static void
2022-08-22 09:54:32 -04:00
meta_window_move_between_rects ( MetaWindow * window ,
2018-11-06 07:35:31 -05:00
MetaMoveResizeFlags move_resize_flags ,
2011-05-20 04:56:12 -04:00
const MetaRectangle * old_area ,
const MetaRectangle * new_area )
{
2022-08-22 09:54:32 -04:00
double rel_x , rel_y ;
int new_x , new_y ;
2011-05-20 04:56:12 -04:00
2022-08-22 09:54:32 -04:00
if ( ! old_area )
2016-11-15 08:10:05 -05:00
{
2022-08-22 09:54:32 -04:00
new_x = new_area - > x ;
new_y = new_area - > y ;
}
else if ( meta_rectangle_contains_rect ( old_area , & window - > unconstrained_rect ) & &
old_area - > width > window - > unconstrained_rect . width & &
old_area - > height > window - > unconstrained_rect . height & &
new_area - > width > = window - > unconstrained_rect . width & &
new_area - > height > = window - > unconstrained_rect . height )
{
rel_x = ( double ) ( window - > unconstrained_rect . x - old_area - > x ) /
( old_area - > width - window - > unconstrained_rect . width ) ;
rel_y = ( double ) ( window - > unconstrained_rect . y - old_area - > y ) /
( old_area - > height - window - > unconstrained_rect . height ) ;
g_warn_if_fail ( rel_x > = 0.0 & & rel_x < = 1.0 & &
rel_y > = 0.0 & & rel_y < = 1.0 ) ;
new_x = new_area - > x +
rel_x * ( new_area - > width - window - > unconstrained_rect . width ) ;
new_y = new_area - > y +
rel_y * ( new_area - > height - window - > unconstrained_rect . height ) ;
2016-11-15 08:10:05 -05:00
}
else
{
2022-08-22 09:54:32 -04:00
rel_x = ( float ) ( window - > unconstrained_rect . x - old_area - > x +
( window - > unconstrained_rect . width / 2 ) ) / old_area - > width ;
rel_y = ( float ) ( window - > unconstrained_rect . y - old_area - > y +
( window - > unconstrained_rect . height / 2 ) ) / old_area - > height ;
rel_x = CLAMP ( rel_x , FLT_EPSILON , 1.0 - FLT_EPSILON ) ;
rel_y = CLAMP ( rel_y , FLT_EPSILON , 1.0 - FLT_EPSILON ) ;
new_x = new_area - > x - ( window - > unconstrained_rect . width / 2 ) +
( rel_x * new_area - > width ) ;
new_y = new_area - > y - ( window - > unconstrained_rect . height / 2 ) +
( rel_y * new_area - > height ) ;
2016-11-15 08:10:05 -05:00
}
2011-05-20 04:56:12 -04:00
2022-08-22 09:54:32 -04:00
window - > unconstrained_rect . x = new_x ;
window - > unconstrained_rect . y = new_y ;
2011-05-20 04:56:12 -04:00
2018-11-06 07:35:31 -05:00
meta_window_move_resize_internal ( window ,
2022-03-04 09:23:38 -05:00
( move_resize_flags |
META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION |
META_MOVE_RESIZE_CONSTRAIN ) ,
2020-02-14 03:44:43 -05:00
META_GRAVITY_NORTH_WEST ,
2018-11-06 07:35:31 -05:00
window - > unconstrained_rect ) ;
2011-05-20 04:56:12 -04:00
}
2011-06-04 21:02:44 -04:00
/**
* meta_window_move_resize_frame :
* @ window : a # MetaWindow
* @ user_op : bool to indicate whether or not this is a user operation
* @ root_x_nw : new x
* @ root_y_nw : new y
* @ w : desired width
* @ h : desired height
*
* Resizes the window so that its outer bounds ( including frame )
* fit within the given rect
*/
void
meta_window_move_resize_frame ( MetaWindow * window ,
gboolean user_op ,
int root_x_nw ,
int root_y_nw ,
int w ,
int h )
{
2014-05-20 17:47:10 -04:00
MetaMoveResizeFlags flags ;
2013-11-15 16:11:20 -05:00
MetaRectangle rect = { root_x_nw , root_y_nw , w , h } ;
2012-03-12 23:11:07 -04:00
2014-05-20 17:47:10 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2022-03-04 09:23:38 -05:00
flags = ( ( user_op ? META_MOVE_RESIZE_USER_ACTION : 0 ) |
META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION |
META_MOVE_RESIZE_CONSTRAIN ) ;
2014-05-20 17:47:10 -04:00
2020-02-14 03:44:43 -05:00
meta_window_move_resize_internal ( window , flags , META_GRAVITY_NORTH_WEST , rect ) ;
2011-06-04 21:02:44 -04:00
}
2011-03-21 07:36:01 -04:00
/**
* meta_window_move_to_monitor :
* @ window : a # MetaWindow
* @ monitor : desired monitor index
*
* Moves the window to the monitor with index @ monitor , keeping
* the relative position of the window ' s top left corner .
*/
void
meta_window_move_to_monitor ( MetaWindow * window ,
int monitor )
{
MetaRectangle old_area , new_area ;
2017-06-15 20:29:48 -04:00
if ( window - > tile_mode ! = META_TILE_NONE )
window - > tile_monitor_number = monitor ;
2011-03-21 07:36:01 -04:00
meta_window_get_work_area_for_monitor ( window ,
window - > monitor - > number ,
& old_area ) ;
meta_window_get_work_area_for_monitor ( window ,
monitor ,
& new_area ) ;
2016-11-15 08:10:05 -05:00
if ( window - > unconstrained_rect . width = = 0 | |
window - > unconstrained_rect . height = = 0 | |
! meta_rectangle_overlap ( & window - > unconstrained_rect , & old_area ) )
{
2018-11-06 07:35:31 -05:00
meta_window_move_between_rects ( window , 0 , NULL , & new_area ) ;
2016-11-15 08:10:05 -05:00
}
else
{
2022-08-06 07:02:19 -04:00
MetaRectangle old_frame_rect , old_buffer_rect ;
2016-11-15 08:10:05 -05:00
if ( monitor = = window - > monitor - > number )
return ;
2022-08-06 07:02:19 -04:00
meta_window_get_frame_rect ( window , & old_frame_rect ) ;
meta_window_get_buffer_rect ( window , & old_buffer_rect ) ;
meta_compositor_size_change_window ( window - > display - > compositor , window ,
META_SIZE_CHANGE_MONITOR_MOVE ,
& old_frame_rect , & old_buffer_rect ) ;
2018-11-06 07:35:31 -05:00
meta_window_move_between_rects ( window , 0 , & old_area , & new_area ) ;
2016-11-15 08:10:05 -05:00
}
2014-07-01 13:23:05 -04:00
window - > preferred_output_winsys_id = window - > monitor - > winsys_id ;
2014-04-17 05:19:53 -04:00
if ( window - > fullscreen | | window - > override_redirect )
2017-08-26 15:10:38 -04:00
meta_display_queue_check_fullscreen ( window - > display ) ;
2011-03-21 07:36:01 -04:00
}
2017-06-11 21:13:03 -04:00
static void
adjust_size_for_tile_match ( MetaWindow * window ,
int * new_w ,
int * new_h )
{
MetaRectangle work_area , rect ;
MetaWindow * tile_match = window - > tile_match ;
if ( ! META_WINDOW_TILED_SIDE_BY_SIDE ( window ) | | ! tile_match )
return ;
meta_window_get_work_area_for_monitor ( window , window - > tile_monitor_number , & work_area ) ;
/* Make sure the resize does not break minimum sizes */
rect = work_area ;
rect . width = * new_w ;
meta_window_frame_rect_to_client_rect ( window , & rect , & rect ) ;
* new_w + = MAX ( 0 , window - > size_hints . min_width - rect . width ) ;
/* Make sure we're not resizing the tile match below its min width */
rect = work_area ;
rect . width = work_area . width - * new_w ;
meta_window_frame_rect_to_client_rect ( tile_match , & rect , & rect ) ;
* new_w - = MAX ( 0 , tile_match - > size_hints . min_width - rect . width ) ;
}
2001-06-30 19:17:52 -04:00
void
2014-05-20 18:28:56 -04:00
meta_window_resize_frame_with_gravity ( MetaWindow * window ,
gboolean user_op ,
int w ,
int h ,
2020-02-14 03:44:43 -05:00
MetaGravity gravity )
2001-06-30 19:17:52 -04:00
{
Patch from Jens Granseuer to fix build with gcc 2.95. #322622.
2006-01-02 Elijah Newren <newren@gmail.com>
Patch from Jens Granseuer to fix build with gcc 2.95. #322622.
* src/boxes.c (meta_rectangle_region_to_string,
meta_rectangle_edge_list_to_string, fix_up_edges):
* src/constraints.c (meta_window_constrain, setup_constraint_info,
place_window_if_needed, constrain_maximization,
constrain_fullscreen, constrain_size_increments,
constrain_size_limits, constrain_aspect_ratio,
do_screen_and_xinerama_relative_constrai,
constrain_to_single_xinerama, constrain_fully_onscreen,
constrain_partially_onscreen):
* src/edge-resistance.c (find_nearest_position,
apply_edge_resistance, apply_edge_resistance_to_each_side):
* src/testboxes.c (test_clamping_to_region,
test_clipping_to_region, test_shoving_into_region):
* src/window.c (meta_window_new_with_attrs,
meta_window_apply_session_info, meta_window_resize,
meta_window_resize_with_gravity, meta_window_configure_request):
Remove C99 style variable initiailization
2006-01-02 13:37:46 -05:00
MetaMoveResizeFlags flags ;
2014-05-01 19:09:13 -04:00
MetaRectangle rect ;
2001-06-30 19:17:52 -04:00
2014-05-01 19:09:13 -04:00
rect . width = w ;
rect . height = h ;
2008-12-18 07:41:56 -05:00
2017-09-27 08:37:57 -04:00
if ( user_op )
2017-06-11 21:13:03 -04:00
{
2022-10-21 06:56:24 -04:00
MetaWindowDrag * window_drag ;
window_drag =
meta_compositor_get_current_window_drag ( window - > display - > compositor ) ;
2017-06-11 21:13:03 -04:00
/* When resizing in-tandem with a tile match, we need to respect
* its minimum width
*/
2022-10-21 06:56:24 -04:00
if ( window_drag & &
meta_window_drag_get_window ( window_drag ) = = window )
2017-06-11 21:13:03 -04:00
adjust_size_for_tile_match ( window , & w , & h ) ;
meta_window_update_tile_fraction ( window , w , h ) ;
}
2017-09-27 08:37:57 -04:00
2022-03-04 09:23:38 -05:00
flags = ( ( user_op ? META_MOVE_RESIZE_USER_ACTION : 0 ) |
META_MOVE_RESIZE_RESIZE_ACTION |
META_MOVE_RESIZE_CONSTRAIN ) ;
2014-05-01 19:09:13 -04:00
meta_window_move_resize_internal ( window , flags , gravity , rect ) ;
2001-06-30 19:17:52 -04:00
}
2022-01-28 18:49:50 -05:00
void
meta_window_update_layout ( MetaWindow * window )
2001-06-09 17:58:30 -04:00
{
2014-05-20 17:47:10 -04:00
meta_window_move_resize_frame ( window , FALSE ,
window - > unconstrained_rect . x ,
window - > unconstrained_rect . y ,
window - > unconstrained_rect . width ,
window - > unconstrained_rect . height ) ;
2001-06-09 17:58:30 -04:00
}
2001-07-07 14:36:50 -04:00
void
meta_window_get_gravity_position ( MetaWindow * window ,
2020-02-14 03:44:43 -05:00
MetaGravity gravity ,
2001-07-07 14:36:50 -04:00
int * root_x ,
int * root_y )
{
MetaRectangle frame_extents ;
int w , h ;
int x , y ;
2008-12-18 07:41:56 -05:00
2001-07-07 14:36:50 -04:00
w = window - > rect . width ;
h = window - > rect . height ;
2020-02-14 03:44:43 -05:00
if ( gravity = = META_GRAVITY_STATIC )
2001-08-18 22:29:38 -04:00
{
frame_extents = window - > rect ;
if ( window - > frame )
{
frame_extents . x = window - > frame - > rect . x + window - > frame - > child_x ;
frame_extents . y = window - > frame - > rect . y + window - > frame - > child_y ;
}
}
2001-07-07 14:36:50 -04:00
else
2001-08-18 22:29:38 -04:00
{
if ( window - > frame = = NULL )
frame_extents = window - > rect ;
else
frame_extents = window - > frame - > rect ;
}
2001-07-07 14:36:50 -04:00
x = frame_extents . x ;
y = frame_extents . y ;
2008-12-18 07:41:56 -05:00
2007-04-09 19:00:55 -04:00
switch ( gravity )
2001-07-07 14:36:50 -04:00
{
2020-02-14 03:44:43 -05:00
case META_GRAVITY_NORTH :
case META_GRAVITY_CENTER :
case META_GRAVITY_SOUTH :
2001-07-07 14:36:50 -04:00
/* Find center of frame. */
x + = frame_extents . width / 2 ;
/* Center client window on that point. */
x - = w / 2 ;
break ;
2008-12-18 07:41:56 -05:00
2020-02-14 03:44:43 -05:00
case META_GRAVITY_SOUTH_EAST :
case META_GRAVITY_EAST :
case META_GRAVITY_NORTH_EAST :
2001-07-07 14:36:50 -04:00
/* Find right edge of frame */
x + = frame_extents . width ;
/* Align left edge of client at that point. */
x - = w ;
break ;
default :
break ;
}
2008-12-18 07:41:56 -05:00
2007-04-09 19:00:55 -04:00
switch ( gravity )
2001-07-07 14:36:50 -04:00
{
2020-02-14 03:44:43 -05:00
case META_GRAVITY_WEST :
case META_GRAVITY_CENTER :
case META_GRAVITY_EAST :
2001-07-07 14:36:50 -04:00
/* Find center of frame. */
y + = frame_extents . height / 2 ;
/* Center client window there. */
y - = h / 2 ;
break ;
2020-02-14 03:44:43 -05:00
case META_GRAVITY_SOUTH_WEST :
case META_GRAVITY_SOUTH :
case META_GRAVITY_SOUTH_EAST :
2001-07-07 14:36:50 -04:00
/* Find south edge of frame */
y + = frame_extents . height ;
/* Place bottom edge of client there */
y - = h ;
break ;
default :
break ;
}
2008-12-18 07:41:56 -05:00
2001-07-07 14:36:50 -04:00
if ( root_x )
* root_x = x ;
if ( root_y )
* root_y = y ;
}
2001-07-28 02:35:19 -04:00
void
2014-05-21 13:49:24 -04:00
meta_window_get_session_geometry ( MetaWindow * window ,
int * x ,
int * y ,
int * width ,
int * height )
2001-07-28 02:35:19 -04:00
{
2007-04-09 19:00:55 -04:00
meta_window_get_gravity_position ( window ,
window - > size_hints . win_gravity ,
x , y ) ;
2001-07-28 02:35:19 -04:00
* width = ( window - > rect . width - window - > size_hints . base_width ) /
window - > size_hints . width_inc ;
* height = ( window - > rect . height - window - > size_hints . base_height ) /
window - > size_hints . height_inc ;
}
2011-06-29 13:37:04 -04:00
/**
window: Rename get_input_rect to get_buffer_rect
With get_input_region existing, get_input_rect is a misnomer. Really,
it's about the geometry of the output surface, and it's only used that
way in the compositor code.
Way back when in GNOME 3.2, get_input_rect was added when we added
invisible borders. get_outer_rect was always synonymous with server-side
geometry of the toplevel. get_outer_rect was used for both user-side
policy (the "frame rect") and to get the geometry of the window.
Invisible borders were meant to extend the input region of the frame
window silently. Since most users of get_outer_rect cared about the
frame rect, we kept that the same and added a new method, get_input_rect
to get the full rect of the framed window with all invisible borders for
input kept on.
As time went on and CSD and Wayland became a reality, the relationship
between the server-side geometry and the "frame rect" became more
complicated, as can be evidenced by the recent commits. Since clients
don't tend to be framed anymore, they set their own input region.
get_buffer_rect is also sort of a poor name, since X11 doesn't really
have buffers, but we don't really have many other alternatives.
This doesn't change any of the code, nor the meaning. It will always
refer to the rectangle where the toplevel should be placed.
2014-06-17 10:33:52 -04:00
* meta_window_get_buffer_rect :
2011-06-29 13:37:04 -04:00
* @ window : a # MetaWindow
* @ rect : ( out ) : pointer to an allocated # MetaRectangle
*
window: Rename get_input_rect to get_buffer_rect
With get_input_region existing, get_input_rect is a misnomer. Really,
it's about the geometry of the output surface, and it's only used that
way in the compositor code.
Way back when in GNOME 3.2, get_input_rect was added when we added
invisible borders. get_outer_rect was always synonymous with server-side
geometry of the toplevel. get_outer_rect was used for both user-side
policy (the "frame rect") and to get the geometry of the window.
Invisible borders were meant to extend the input region of the frame
window silently. Since most users of get_outer_rect cared about the
frame rect, we kept that the same and added a new method, get_input_rect
to get the full rect of the framed window with all invisible borders for
input kept on.
As time went on and CSD and Wayland became a reality, the relationship
between the server-side geometry and the "frame rect" became more
complicated, as can be evidenced by the recent commits. Since clients
don't tend to be framed anymore, they set their own input region.
get_buffer_rect is also sort of a poor name, since X11 doesn't really
have buffers, but we don't really have many other alternatives.
This doesn't change any of the code, nor the meaning. It will always
refer to the rectangle where the toplevel should be placed.
2014-06-17 10:33:52 -04:00
* Gets the rectangle that the pixmap or buffer of @ window occupies .
*
* For X11 windows , this is the server - side geometry of the toplevel
* window .
*
* For Wayland windows , this is the bounding rectangle of the attached
* buffer .
2011-06-29 13:37:04 -04:00
*/
void
window: Rename get_input_rect to get_buffer_rect
With get_input_region existing, get_input_rect is a misnomer. Really,
it's about the geometry of the output surface, and it's only used that
way in the compositor code.
Way back when in GNOME 3.2, get_input_rect was added when we added
invisible borders. get_outer_rect was always synonymous with server-side
geometry of the toplevel. get_outer_rect was used for both user-side
policy (the "frame rect") and to get the geometry of the window.
Invisible borders were meant to extend the input region of the frame
window silently. Since most users of get_outer_rect cared about the
frame rect, we kept that the same and added a new method, get_input_rect
to get the full rect of the framed window with all invisible borders for
input kept on.
As time went on and CSD and Wayland became a reality, the relationship
between the server-side geometry and the "frame rect" became more
complicated, as can be evidenced by the recent commits. Since clients
don't tend to be framed anymore, they set their own input region.
get_buffer_rect is also sort of a poor name, since X11 doesn't really
have buffers, but we don't really have many other alternatives.
This doesn't change any of the code, nor the meaning. It will always
refer to the rectangle where the toplevel should be placed.
2014-06-17 10:33:52 -04:00
meta_window_get_buffer_rect ( const MetaWindow * window ,
MetaRectangle * rect )
2011-06-29 13:37:04 -04:00
{
2014-06-17 11:03:29 -04:00
* rect = window - > buffer_rect ;
2011-06-29 13:37:04 -04:00
}
2013-11-15 16:11:20 -05:00
/**
* meta_window_client_rect_to_frame_rect :
* @ window : a # MetaWindow
2013-11-29 07:52:18 -05:00
* @ client_rect : client rectangle in root coordinates
* @ frame_rect : ( out ) : location to store the computed corresponding frame bounds .
2013-11-15 16:11:20 -05:00
*
2015-07-06 03:52:49 -04:00
* Converts a desired bounds of the client window into the corresponding bounds
* of the window frame ( excluding invisible borders and client side shadows . )
2013-11-15 16:11:20 -05:00
*/
void
meta_window_client_rect_to_frame_rect ( MetaWindow * window ,
2013-11-29 07:52:18 -05:00
MetaRectangle * client_rect ,
MetaRectangle * frame_rect )
2013-11-15 16:11:20 -05:00
{
2013-11-29 07:52:18 -05:00
if ( ! frame_rect )
2013-11-15 16:11:20 -05:00
return ;
2013-11-29 07:52:18 -05:00
* frame_rect = * client_rect ;
2013-11-15 16:11:20 -05:00
2013-11-15 18:03:50 -05:00
/* The support for G_MAXINT here to mean infinity is a convenience for
* constraints . c : get_size_limits ( ) and not something that we provide
* in other locations or document .
*/
2013-11-15 16:11:20 -05:00
if ( window - > frame )
{
MetaFrameBorders borders ;
meta_frame_calc_borders ( window - > frame , & borders ) ;
2013-11-29 07:52:18 -05:00
frame_rect - > x - = borders . visible . left ;
frame_rect - > y - = borders . visible . top ;
if ( frame_rect - > width ! = G_MAXINT )
frame_rect - > width + = borders . visible . left + borders . visible . right ;
if ( frame_rect - > height ! = G_MAXINT )
frame_rect - > height + = borders . visible . top + borders . visible . bottom ;
2013-11-15 16:11:20 -05:00
}
else
{
2022-05-09 05:24:23 -04:00
const MetaFrameBorder * extents = & window - > custom_frame_extents ;
2014-06-26 11:13:09 -04:00
frame_rect - > x + = extents - > left ;
frame_rect - > y + = extents - > top ;
if ( frame_rect - > width ! = G_MAXINT )
frame_rect - > width - = extents - > left + extents - > right ;
if ( frame_rect - > height ! = G_MAXINT )
frame_rect - > height - = extents - > top + extents - > bottom ;
2013-11-15 16:11:20 -05:00
}
}
/**
* meta_window_frame_rect_to_client_rect :
* @ window : a # MetaWindow
* @ frame_rect : desired frame bounds for the window
* @ client_rect : ( out ) : location to store the computed corresponding client rectangle .
*
* Converts a desired frame bounds for a window into the bounds of the client
2015-07-06 03:52:49 -04:00
* window .
2013-11-15 16:11:20 -05:00
*/
void
meta_window_frame_rect_to_client_rect ( MetaWindow * window ,
MetaRectangle * frame_rect ,
MetaRectangle * client_rect )
{
if ( ! client_rect )
return ;
* client_rect = * frame_rect ;
if ( window - > frame )
{
MetaFrameBorders borders ;
meta_frame_calc_borders ( window - > frame , & borders ) ;
client_rect - > x + = borders . visible . left ;
client_rect - > y + = borders . visible . top ;
client_rect - > width - = borders . visible . left + borders . visible . right ;
client_rect - > height - = borders . visible . top + borders . visible . bottom ;
}
else
{
2022-05-09 05:24:23 -04:00
const MetaFrameBorder * extents = & window - > custom_frame_extents ;
2014-06-26 11:13:09 -04:00
client_rect - > x - = extents - > left ;
client_rect - > y - = extents - > top ;
client_rect - > width + = extents - > left + extents - > right ;
client_rect - > height + = extents - > top + extents - > bottom ;
2013-11-15 16:11:20 -05:00
}
}
2010-11-22 16:26:37 -05:00
/**
2013-11-19 12:24:45 -05:00
* meta_window_get_frame_rect :
2010-11-22 16:26:37 -05:00
* @ window : a # MetaWindow
* @ rect : ( out ) : pointer to an allocated # MetaRectangle
*
2013-11-19 12:24:45 -05:00
* Gets the rectangle that bounds @ window that is what the user thinks of
* as the edge of the window . This doesn ' t include any extra reactive
* area that we or the client adds to the window , or any area that the
* client adds to draw a client - side shadow .
2010-11-22 16:26:37 -05:00
*/
2001-07-12 01:53:56 -04:00
void
2013-11-19 12:24:45 -05:00
meta_window_get_frame_rect ( const MetaWindow * window ,
2006-01-10 00:14:48 -05:00
MetaRectangle * rect )
2001-07-12 01:53:56 -04:00
{
2014-05-20 17:47:10 -04:00
* rect = window - > rect ;
2001-07-12 01:53:56 -04:00
}
2014-02-26 19:33:43 -05:00
/**
* meta_window_get_client_area_rect :
* @ window : a # MetaWindow
* @ rect : ( out ) : pointer to a cairo rectangle
*
* Gets the rectangle for the boundaries of the client area , relative
2014-06-27 11:56:52 -04:00
* to the buffer rect . If the window is shaded , the height of the
* rectangle is 0.
2014-02-26 19:33:43 -05:00
*/
void
meta_window_get_client_area_rect ( const MetaWindow * window ,
cairo_rectangle_int_t * rect )
{
2014-05-20 17:47:10 -04:00
MetaFrameBorders borders ;
meta_frame_calc_borders ( window - > frame , & borders ) ;
rect - > x = borders . total . left ;
rect - > y = borders . total . top ;
2014-02-26 19:33:43 -05:00
2014-06-27 11:56:52 -04:00
rect - > width = window - > buffer_rect . width - borders . total . left - borders . total . right ;
2014-02-26 19:33:43 -05:00
if ( window - > shaded )
rect - > height = 0 ;
2014-02-27 10:32:19 -05:00
else
2014-06-27 11:56:52 -04:00
rect - > height = window - > buffer_rect . height - borders . total . top - borders . total . bottom ;
2014-02-26 19:33:43 -05:00
}
2014-05-22 16:48:58 -04:00
void
meta_window_get_titlebar_rect ( MetaWindow * window ,
MetaRectangle * rect )
{
meta_window_get_frame_rect ( window , rect ) ;
/* The returned rectangle is relative to the frame rect. */
rect - > x = 0 ;
rect - > y = 0 ;
if ( window - > frame )
{
rect - > height = window - > frame - > child_y ;
}
else
{
/* Pick an arbitrary height for a titlebar. We might want to
* eventually have CSD windows expose their borders to us . */
2014-08-19 13:58:45 -04:00
rect - > height = 50 ;
2014-05-22 16:48:58 -04:00
}
}
2022-04-05 06:45:22 -04:00
/**
* meta_window_get_startup_id :
* @ window : a # MetaWindow
*
* Gets the startup id of the given # MetaWindow
*
* Returns : ( nullable ) : the startup id
*/
2002-11-30 22:58:04 -05:00
const char *
meta_window_get_startup_id ( MetaWindow * window )
{
if ( window - > startup_id = = NULL )
{
MetaGroup * group ;
group = meta_window_get_group ( window ) ;
if ( group ! = NULL )
return meta_group_get_startup_id ( group ) ;
}
return window - > startup_id ;
}
2005-01-25 12:26:06 -05:00
static MetaWindow *
get_modal_transient ( MetaWindow * window )
{
GSList * windows ;
GSList * tmp ;
MetaWindow * modal_transient ;
/* A window can't be the transient of itself, but this is just for
* convenience in the loop below ; we manually fix things up at the
* end if no real modal transient was found .
*/
modal_transient = window ;
2009-06-15 15:32:23 -04:00
windows = meta_display_list_windows ( window - > display , META_LIST_DEFAULT ) ;
2005-01-25 12:26:06 -05:00
tmp = windows ;
while ( tmp ! = NULL )
{
MetaWindow * transient = tmp - > data ;
2008-12-18 07:41:56 -05:00
2013-09-16 08:44:37 -04:00
if ( transient - > transient_for = = modal_transient & &
2014-03-18 10:58:26 -04:00
transient - > type = = META_WINDOW_MODAL_DIALOG )
2005-01-25 12:26:06 -05:00
{
modal_transient = transient ;
tmp = windows ;
continue ;
}
2008-12-18 07:41:56 -05:00
2005-01-25 12:26:06 -05:00
tmp = tmp - > next ;
}
g_slist_free ( windows ) ;
if ( window = = modal_transient )
modal_transient = NULL ;
return modal_transient ;
}
window: Fix focus of unmappable modal transient's parent
When a modal transient is unmanaging, most likely the parent of the
modal transient should be focused.
In Wayland, a MetaWindow is created when a shell surface role (like
xdg_toplevel) is created, but a window cannot be shown until a buffer
is attached. If a client would create two modal transients and make
them both have the same parent, but only one get a buffer attached
(i.e. shown), when unmanaging the modal transient that was showing,
when finding a new focus candidate, the stacking code will ignore the
not-to-be-shown buffer-less modal transient when finding a good
candidate for focusing. In the case described here, this means it will
find the parent of the unmanaging modal transient.
This newly chosen candidate will then be passed to meta_window_focus();
meta_window_focus() will then try to find any modal transient to focus
instead, will find the one without any buffer, then fail to focus it
because it cannot be mapped, thus making meta_window_focus() not focus
anything. Since meta_window_focus() didn't change any focus state, the
assert in meta_window_unmanage() checking that the unmanaging window
isn't focused anymore will be hit, causing mutter to abort.
For now, fix this by checking whether the modal transient can actually
be focused in meta_window_focus(). For X11 client windows, a window
will be defined to be focusable always, but for Wayland client windows,
a window will be determined focusable only if it has a buffer attached.
In the future, we should probably do a more thorough refactorization of
focus handling to get rid of any X11 - Wayland differences.
https://bugzilla.gnome.org/show_bug.cgi?id=757568
2016-09-01 06:42:58 -04:00
static gboolean
meta_window_transient_can_focus ( MetaWindow * window )
{
# ifdef HAVE_WAYLAND
if ( window - > client_type = = META_WINDOW_CLIENT_TYPE_WAYLAND )
2022-05-18 07:51:44 -04:00
{
MetaWaylandSurface * surface = meta_window_get_wayland_surface ( window ) ;
return meta_wayland_surface_get_buffer ( surface ) ! = NULL ;
}
window: Fix focus of unmappable modal transient's parent
When a modal transient is unmanaging, most likely the parent of the
modal transient should be focused.
In Wayland, a MetaWindow is created when a shell surface role (like
xdg_toplevel) is created, but a window cannot be shown until a buffer
is attached. If a client would create two modal transients and make
them both have the same parent, but only one get a buffer attached
(i.e. shown), when unmanaging the modal transient that was showing,
when finding a new focus candidate, the stacking code will ignore the
not-to-be-shown buffer-less modal transient when finding a good
candidate for focusing. In the case described here, this means it will
find the parent of the unmanaging modal transient.
This newly chosen candidate will then be passed to meta_window_focus();
meta_window_focus() will then try to find any modal transient to focus
instead, will find the one without any buffer, then fail to focus it
because it cannot be mapped, thus making meta_window_focus() not focus
anything. Since meta_window_focus() didn't change any focus state, the
assert in meta_window_unmanage() checking that the unmanaging window
isn't focused anymore will be hit, causing mutter to abort.
For now, fix this by checking whether the modal transient can actually
be focused in meta_window_focus(). For X11 client windows, a window
will be defined to be focusable always, but for Wayland client windows,
a window will be determined focusable only if it has a buffer attached.
In the future, we should probably do a more thorough refactorization of
focus handling to get rid of any X11 - Wayland differences.
https://bugzilla.gnome.org/show_bug.cgi?id=757568
2016-09-01 06:42:58 -04:00
# endif
return TRUE ;
}
2023-02-23 13:57:43 -05:00
static void
2023-02-23 16:26:02 -05:00
meta_window_make_most_recent ( MetaWindow * window )
{
2023-02-23 13:57:43 -05:00
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
GList * l ;
for ( l = workspace_manager - > workspaces ; l ! = NULL ; l = l - > next )
{
MetaWorkspace * workspace = l - > data ;
GList * link ;
link = g_list_find ( workspace - > mru_list , window ) ;
if ( ! link )
continue ;
workspace - > mru_list = g_list_delete_link ( workspace - > mru_list , link ) ;
workspace - > mru_list = g_list_prepend ( workspace - > mru_list , window ) ;
}
}
2006-05-23 17:42:34 -04:00
/* XXX META_EFFECT_FOCUS */
2001-06-04 00:58:22 -04:00
void
meta_window_focus ( MetaWindow * window ,
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
guint32 timestamp )
2008-12-18 07:41:56 -05:00
{
2017-08-27 15:02:40 -04:00
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
2005-01-25 12:26:06 -05:00
MetaWindow * modal_transient ;
2022-05-27 08:14:31 -04:00
MetaBackend * backend ;
ClutterStage * stage ;
2022-10-21 06:56:24 -04:00
MetaWindowDrag * window_drag ;
MetaWindow * grab_window = NULL ;
2005-01-25 12:26:06 -05:00
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2018-08-21 18:58:06 -04:00
/* This is a oneshot flag */
window - > restore_focus_on_map = FALSE ;
2002-01-03 18:28:19 -05:00
meta_topic ( META_DEBUG_FOCUS ,
2020-10-02 11:47:22 -04:00
" Setting input focus to window %s, input: %d focusable: %d " ,
2019-01-30 14:19:41 -05:00
window - > desc , window - > input , meta_window_is_focusable ( window ) ) ;
2008-12-18 07:41:56 -05:00
2022-11-06 06:38:35 -05:00
if ( window - > in_workspace_change )
{
meta_topic ( META_DEBUG_FOCUS ,
" Window %s is currently changing workspaces, not focusing it after all " ,
window - > desc ) ;
return ;
}
2022-10-21 06:56:24 -04:00
window_drag =
meta_compositor_get_current_window_drag ( window - > display - > compositor ) ;
if ( window_drag )
grab_window = meta_window_drag_get_window ( window_drag ) ;
if ( grab_window & &
grab_window ! = window & &
! grab_window - > unmanaging )
2001-07-11 02:22:00 -04:00
{
2002-01-05 22:15:49 -05:00
meta_topic ( META_DEBUG_FOCUS ,
2020-10-02 11:47:22 -04:00
" Current focus window %s has global keygrab, not focusing window %s after all " ,
2022-10-21 06:56:24 -04:00
grab_window - > desc , window - > desc ) ;
2001-07-11 02:22:00 -04:00
return ;
}
2001-10-29 02:00:46 -05:00
2005-01-25 12:26:06 -05:00
modal_transient = get_modal_transient ( window ) ;
2005-06-02 11:24:40 -04:00
if ( modal_transient ! = NULL & &
window: Fix focus of unmappable modal transient's parent
When a modal transient is unmanaging, most likely the parent of the
modal transient should be focused.
In Wayland, a MetaWindow is created when a shell surface role (like
xdg_toplevel) is created, but a window cannot be shown until a buffer
is attached. If a client would create two modal transients and make
them both have the same parent, but only one get a buffer attached
(i.e. shown), when unmanaging the modal transient that was showing,
when finding a new focus candidate, the stacking code will ignore the
not-to-be-shown buffer-less modal transient when finding a good
candidate for focusing. In the case described here, this means it will
find the parent of the unmanaging modal transient.
This newly chosen candidate will then be passed to meta_window_focus();
meta_window_focus() will then try to find any modal transient to focus
instead, will find the one without any buffer, then fail to focus it
because it cannot be mapped, thus making meta_window_focus() not focus
anything. Since meta_window_focus() didn't change any focus state, the
assert in meta_window_unmanage() checking that the unmanaging window
isn't focused anymore will be hit, causing mutter to abort.
For now, fix this by checking whether the modal transient can actually
be focused in meta_window_focus(). For X11 client windows, a window
will be defined to be focusable always, but for Wayland client windows,
a window will be determined focusable only if it has a buffer attached.
In the future, we should probably do a more thorough refactorization of
focus handling to get rid of any X11 - Wayland differences.
https://bugzilla.gnome.org/show_bug.cgi?id=757568
2016-09-01 06:42:58 -04:00
! modal_transient - > unmanaging & &
meta_window_transient_can_focus ( modal_transient ) )
2005-01-25 12:26:06 -05:00
{
meta_topic ( META_DEBUG_FOCUS ,
2020-10-02 11:47:22 -04:00
" %s has %s as a modal transient, so focusing it instead. " ,
2005-01-25 12:26:06 -05:00
window - > desc , modal_transient - > desc ) ;
2017-08-27 15:02:40 -04:00
if ( ! meta_window_located_on_workspace ( modal_transient , workspace_manager - > active_workspace ) )
meta_window_change_workspace ( modal_transient , workspace_manager - > active_workspace ) ;
2005-01-25 12:26:06 -05:00
window = modal_transient ;
}
2001-10-29 02:00:46 -05:00
meta_window_flush_calc_showing ( window ) ;
2002-05-10 22:25:11 -04:00
2008-11-03 07:36:55 -05:00
if ( ( ! window - > mapped | | window - > hidden ) & & ! window - > shaded )
2002-05-10 22:25:11 -04:00
{
meta_topic ( META_DEBUG_FOCUS ,
2020-10-02 11:47:22 -04:00
" Window %s is not showing, not focusing after all " ,
2002-05-10 22:25:11 -04:00
window - > desc ) ;
return ;
}
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
2014-03-20 15:16:57 -04:00
META_WINDOW_GET_CLASS ( window ) - > focus ( window , timestamp ) ;
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
2022-12-07 12:20:49 -05:00
/* Move to the front of all workspaces' MRU lists the window
* is on . We should only be " removing " it from the MRU list if
* it ' s already there . Note that it ' s possible that we might
2022-07-13 10:13:48 -04:00
* be processing this FocusIn after we ' ve changed to a
* different workspace ; we should therefore update the MRU
* list only if the window is actually on the active
* workspace .
*/
if ( workspace_manager - > active_workspace & &
meta_window_located_on_workspace ( window ,
workspace_manager - > active_workspace ) )
2023-02-23 13:57:43 -05:00
meta_window_make_most_recent ( window ) ;
2022-07-13 10:13:48 -04:00
2022-05-27 16:27:07 -04:00
backend = backend_from_window ( window ) ;
2022-05-27 08:14:31 -04:00
stage = CLUTTER_STAGE ( meta_backend_get_stage ( backend ) ) ;
2022-10-21 07:45:06 -04:00
if ( clutter_stage_get_grab_actor ( stage ) = = NULL )
2022-05-27 08:14:31 -04:00
clutter_stage_set_key_focus ( stage , NULL ) ;
2016-03-10 11:51:46 -05:00
2017-07-14 17:34:05 -04:00
if ( window - > close_dialog & &
meta_close_dialog_is_visible ( window - > close_dialog ) )
meta_close_dialog_focus ( window - > close_dialog ) ;
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
if ( window - > wm_state_demands_attention )
2006-03-29 13:43:22 -05:00
meta_window_unset_demands_attention ( window ) ;
2006-05-25 10:40:50 -04:00
2009-05-07 13:53:47 -04:00
/* meta_effect_run_focus(window, NULL, NULL); */
2001-06-04 00:58:22 -04:00
}
2014-08-16 13:22:05 -04:00
/* Workspace management. Invariants:
*
* - window - > workspace describes the workspace the window is on .
*
* - workspace - > windows is a list of windows that is located on
* that workspace .
*
2014-09-26 21:58:33 -04:00
* - If the window is on_all_workspaces , then
2014-08-16 13:22:05 -04:00
* window - > workspace = = NULL , but workspace - > windows contains
* the window .
*/
2002-11-22 01:00:18 -05:00
static void
2014-08-16 13:22:05 -04:00
set_workspace_state ( MetaWindow * window ,
gboolean on_all_workspaces ,
MetaWorkspace * workspace )
{
2017-08-27 15:02:40 -04:00
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
2019-10-28 22:54:42 -04:00
/* If we're on all workspaces, then our new workspace must be NULL,
* otherwise it must be set , unless we ' re unmanaging . */
2014-08-16 13:22:05 -04:00
if ( on_all_workspaces )
2019-10-28 22:54:42 -04:00
g_assert_null ( workspace ) ;
else
g_assert_true ( window - > unmanaging | | workspace ! = NULL ) ;
2014-08-16 13:22:05 -04:00
/* If this is an override-redirect window, ensure that the only
* times we ' re setting the workspace state is either during construction
* to mark as on_all_workspaces , or when unmanaging to remove all the
* workspaces . */
if ( window - > override_redirect )
g_return_if_fail ( ( window - > constructing & & on_all_workspaces ) | | window - > unmanaging ) ;
2009-01-20 07:52:06 -05:00
2014-08-16 13:22:05 -04:00
if ( on_all_workspaces = = window - > on_all_workspaces & &
2014-09-25 08:59:25 -04:00
workspace = = window - > workspace & &
! window - > constructing )
2014-08-16 13:22:05 -04:00
return ;
2008-12-18 07:41:56 -05:00
2022-11-06 06:38:35 -05:00
window - > in_workspace_change = TRUE ;
2014-08-16 13:22:05 -04:00
if ( window - > workspace )
meta_workspace_remove_window ( window - > workspace , window ) ;
else if ( window - > on_all_workspaces )
{
GList * l ;
2017-08-27 15:02:40 -04:00
for ( l = workspace_manager - > workspaces ; l ! = NULL ; l = l - > next )
2014-08-16 13:22:05 -04:00
{
2015-09-23 19:24:33 -04:00
MetaWorkspace * ws = l - > data ;
meta_workspace_remove_window ( ws , window ) ;
2014-08-16 13:22:05 -04:00
}
}
window - > on_all_workspaces = on_all_workspaces ;
window - > workspace = workspace ;
if ( window - > workspace )
meta_workspace_add_window ( window - > workspace , window ) ;
else if ( window - > on_all_workspaces )
2009-01-20 07:52:06 -05:00
{
2014-08-16 13:22:05 -04:00
GList * l ;
2017-08-27 15:02:40 -04:00
for ( l = workspace_manager - > workspaces ; l ! = NULL ; l = l - > next )
2014-08-16 13:22:05 -04:00
{
2015-09-23 19:24:33 -04:00
MetaWorkspace * ws = l - > data ;
meta_workspace_add_window ( ws , window ) ;
2014-08-16 13:22:05 -04:00
}
2009-01-20 07:52:06 -05:00
}
2022-11-06 06:38:35 -05:00
window - > in_workspace_change = FALSE ;
2019-10-12 14:55:26 -04:00
if ( ! window - > constructing )
meta_window_update_appears_focused ( window ) ;
2014-08-16 13:22:05 -04:00
/* queue a move_resize since changing workspaces may change
* the relevant struts
2002-10-04 10:49:00 -04:00
*/
2014-08-16 13:22:05 -04:00
if ( ! window - > override_redirect )
meta_window_queue ( window , META_QUEUE_MOVE_RESIZE ) ;
meta_window_queue ( window , META_QUEUE_CALC_SHOWING ) ;
meta_window_current_workspace_changed ( window ) ;
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_ON_ALL_WORKSPACES ] ) ;
g_signal_emit ( window , window_signals [ WORKSPACE_CHANGED ] , 0 ) ;
}
static gboolean
should_be_on_all_workspaces ( MetaWindow * window )
{
2017-09-25 15:10:58 -04:00
if ( window - > always_sticky )
return TRUE ;
if ( window - > on_all_workspaces_requested )
return TRUE ;
if ( window - > override_redirect )
return TRUE ;
if ( meta_prefs_get_workspaces_only_on_primary ( ) & &
! window - > unmanaging & &
window - > monitor & &
! meta_window_is_on_primary_monitor ( window ) )
return TRUE ;
return FALSE ;
2014-08-16 13:22:05 -04:00
}
void
meta_window_on_all_workspaces_changed ( MetaWindow * window )
{
2017-08-27 15:02:40 -04:00
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
2014-08-16 13:22:05 -04:00
gboolean on_all_workspaces = should_be_on_all_workspaces ( window ) ;
if ( window - > on_all_workspaces = = on_all_workspaces )
return ;
2002-10-04 10:49:00 -04:00
2014-08-16 13:22:05 -04:00
MetaWorkspace * workspace ;
if ( on_all_workspaces )
{
workspace = NULL ;
}
else
2002-08-06 00:11:23 -04:00
{
2014-08-16 13:22:05 -04:00
/* We're coming out of the sticky state. Put the window on
* the currently active workspace . */
2017-08-27 15:02:40 -04:00
workspace = workspace_manager - > active_workspace ;
2002-08-06 00:11:23 -04:00
}
2014-08-16 13:22:05 -04:00
set_workspace_state ( window , on_all_workspaces , workspace ) ;
}
static void
meta_window_change_workspace_without_transients ( MetaWindow * window ,
MetaWorkspace * workspace )
{
2021-09-16 13:58:57 -04:00
if ( window - > unmanaging )
return ;
2014-08-16 13:22:05 -04:00
/* Try to unstick the window if it's stuck. This doesn't
* have any guarantee that we ' ll actually unstick the
* window , since it could be stuck for other reasons . */
if ( window - > on_all_workspaces_requested )
meta_window_unstick ( window ) ;
/* We failed to unstick the window. */
if ( window - > on_all_workspaces )
return ;
if ( window - > workspace = = workspace )
return ;
set_workspace_state ( window , FALSE , workspace ) ;
2001-06-09 01:14:43 -04:00
}
2003-03-17 01:36:39 -05:00
static gboolean
2002-11-22 01:00:18 -05:00
change_workspace_foreach ( MetaWindow * window ,
void * data )
{
meta_window_change_workspace_without_transients ( window , data ) ;
2003-03-17 01:36:39 -05:00
return TRUE ;
2002-11-22 01:00:18 -05:00
}
void
meta_window_change_workspace ( MetaWindow * window ,
MetaWorkspace * workspace )
{
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2002-11-22 01:00:18 -05:00
meta_window_change_workspace_without_transients ( window , workspace ) ;
meta_window_foreach_transient ( window , change_workspace_foreach ,
workspace ) ;
2005-10-03 15:00:01 -04:00
meta_window_foreach_ancestor ( window , change_workspace_foreach ,
workspace ) ;
2002-11-22 01:00:18 -05:00
}
2005-01-26 18:25:05 -05:00
static void
window_stick_impl ( MetaWindow * window )
2001-06-09 23:17:15 -04:00
{
2020-10-02 11:47:22 -04:00
meta_verbose ( " Sticking window %s current on_all_workspaces = %d " ,
2002-11-19 23:37:55 -05:00
window - > desc , window - > on_all_workspaces ) ;
2008-12-18 07:41:56 -05:00
2011-02-28 05:41:23 -05:00
if ( window - > on_all_workspaces_requested )
2001-06-09 23:17:15 -04:00
return ;
/* We don't change window->workspaces, because we revert
* to that original workspace list if on_all_workspaces is
* toggled back off .
*/
2011-02-28 05:41:23 -05:00
window - > on_all_workspaces_requested = TRUE ;
2014-08-16 13:22:05 -04:00
meta_window_on_all_workspaces_changed ( window ) ;
2001-06-09 23:17:15 -04:00
}
2005-01-26 18:25:05 -05:00
static void
window_unstick_impl ( MetaWindow * window )
2001-06-09 23:17:15 -04:00
{
2011-02-28 05:41:23 -05:00
if ( ! window - > on_all_workspaces_requested )
2001-06-09 23:17:15 -04:00
return ;
/* Revert to window->workspaces */
2011-02-28 05:41:23 -05:00
window - > on_all_workspaces_requested = FALSE ;
2014-08-16 13:22:05 -04:00
meta_window_on_all_workspaces_changed ( window ) ;
2001-06-09 23:17:15 -04:00
}
2005-01-26 18:25:05 -05:00
static gboolean
stick_foreach_func ( MetaWindow * window ,
void * data )
{
gboolean stick ;
stick = * ( gboolean * ) data ;
if ( stick )
window_stick_impl ( window ) ;
else
window_unstick_impl ( window ) ;
return TRUE ;
}
void
meta_window_stick ( MetaWindow * window )
{
gboolean stick = TRUE ;
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2005-01-26 18:25:05 -05:00
window_stick_impl ( window ) ;
meta_window_foreach_transient ( window ,
stick_foreach_func ,
& stick ) ;
}
void
meta_window_unstick ( MetaWindow * window )
{
gboolean stick = FALSE ;
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2005-01-26 18:25:05 -05:00
window_unstick_impl ( window ) ;
meta_window_foreach_transient ( window ,
stick_foreach_func ,
& stick ) ;
}
2002-10-21 17:44:35 -04:00
void
2014-05-20 15:46:21 -04:00
meta_window_current_workspace_changed ( MetaWindow * window )
2001-06-09 23:17:15 -04:00
{
2014-05-20 15:46:21 -04:00
META_WINDOW_GET_CLASS ( window ) - > current_workspace_changed ( window ) ;
2001-06-09 23:17:15 -04:00
}
2005-02-12 02:34:30 -05:00
static gboolean
find_root_ancestor ( MetaWindow * window ,
void * data )
{
MetaWindow * * ancestor = data ;
/* Overwrite the previously "most-root" ancestor with the new one found */
* ancestor = window ;
/* We want this to continue until meta_window_foreach_ancestor quits because
* there are no more valid ancestors .
*/
return TRUE ;
}
2010-09-01 15:39:53 -04:00
/**
* meta_window_find_root_ancestor :
* @ window : a # MetaWindow
*
* Follow the chain of parents of @ window , skipping transient windows ,
* and return the " root " window which has no non - transient parent .
*
* Returns : ( transfer none ) : The root ancestor window
*/
2006-03-30 14:22:38 -05:00
MetaWindow *
meta_window_find_root_ancestor ( MetaWindow * window )
2001-06-06 00:47:37 -04:00
{
2005-02-12 02:34:30 -05:00
MetaWindow * ancestor ;
ancestor = window ;
meta_window_foreach_ancestor ( window , find_root_ancestor , & ancestor ) ;
2006-03-30 14:22:38 -05:00
return ancestor ;
}
void
meta_window_raise ( MetaWindow * window )
{
MetaWindow * ancestor ;
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2006-03-30 14:22:38 -05:00
ancestor = meta_window_find_root_ancestor ( window ) ;
2005-02-12 02:34:30 -05:00
2002-02-07 22:34:26 -05:00
meta_topic ( META_DEBUG_WINDOW_OPS ,
2020-10-02 11:47:22 -04:00
" Raising window %s, ancestor of %s " ,
2005-02-12 02:34:30 -05:00
ancestor - > desc , window - > desc ) ;
2001-06-06 00:47:37 -04:00
2005-07-24 21:52:50 -04:00
/* Raise the ancestor of the window (if the window has no ancestor,
* then ancestor will be set to the window itself ) ; do this because
* it ' s weird to see windows from other apps stacked between a child
* and parent window of the currently active app . The stacking
* constraints in stack . c then magically take care of raising all
* the child windows appropriately .
*/
2017-08-26 13:03:51 -04:00
if ( window - > display - > stack = = ancestor - > display - > stack )
{
meta_stack_raise ( window - > display - > stack , ancestor ) ;
}
2005-07-24 21:52:50 -04:00
else
2005-02-12 02:34:30 -05:00
{
meta_warning (
" Either stacks aren't per screen or some window has a weird "
2017-08-26 13:03:51 -04:00
" transient_for hint; window->display->stack != "
2020-10-02 11:47:22 -04:00
" ancestor->screen->stack. window = %s, ancestor = %s. " ,
2005-02-12 02:34:30 -05:00
window - > desc , ancestor - > desc ) ;
2005-07-24 21:52:50 -04:00
/* We could raise the window here, but don't want to do that twice and
* so we let the case below handle that .
*/
2005-02-12 02:34:30 -05:00
}
2005-07-24 21:52:50 -04:00
/* Okay, so stacking constraints misses one case: If a window has
* two children and we want to raise one of those children , then
* raising the ancestor isn ' t enough ; we need to also raise the
* correct child . See bug 307875.
*/
if ( window ! = ancestor )
2017-08-26 13:03:51 -04:00
meta_stack_raise ( window - > display - > stack , window ) ;
2009-02-02 09:08:46 -05:00
g_signal_emit ( window , window_signals [ RAISED ] , 0 ) ;
2001-06-06 00:47:37 -04:00
}
2023-02-23 13:57:43 -05:00
void
meta_window_raise_and_make_recent ( MetaWindow * window )
{
g_return_if_fail ( META_IS_WINDOW ( window ) ) ;
meta_window_raise ( window ) ;
meta_window_make_most_recent ( window ) ;
}
2001-09-16 17:50:27 -04:00
void
meta_window_lower ( MetaWindow * window )
{
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2002-02-07 22:34:26 -05:00
meta_topic ( META_DEBUG_WINDOW_OPS ,
2020-10-02 11:47:22 -04:00
" Lowering window %s " , window - > desc ) ;
2001-09-16 17:50:27 -04:00
2017-08-26 13:03:51 -04:00
meta_stack_lower ( window - > display - > stack , window ) ;
2001-09-16 17:50:27 -04:00
}
2021-07-28 20:37:26 -04:00
static gboolean
lower_window_and_transients ( MetaWindow * window ,
gpointer user_data )
{
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
meta_window_lower ( window ) ;
meta_window_foreach_transient ( window , lower_window_and_transients , NULL ) ;
if ( meta_prefs_get_raise_on_click ( ) )
{
/* Move window to the back of the focusing workspace's MRU list.
* Do extra sanity checks to avoid possible race conditions .
* ( Borrowed from window . c . )
*/
if ( workspace_manager - > active_workspace & &
meta_window_located_on_workspace ( window ,
workspace_manager - > active_workspace ) )
{
GList * link ;
link = g_list_find ( workspace_manager - > active_workspace - > mru_list ,
window ) ;
g_assert ( link ) ;
workspace_manager - > active_workspace - > mru_list =
g_list_remove_link ( workspace_manager - > active_workspace - > mru_list ,
link ) ;
g_list_free ( link ) ;
workspace_manager - > active_workspace - > mru_list =
g_list_append ( workspace_manager - > active_workspace - > mru_list ,
window ) ;
}
}
return FALSE ;
}
void
meta_window_lower_with_transients ( MetaWindow * window ,
uint32_t timestamp )
{
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
lower_window_and_transients ( window , NULL ) ;
/* Rather than try to figure that out whether we just lowered
* the focus window , assume that ' s always the case . ( Typically ,
* this will be invoked via keyboard action or by a mouse action ;
* in either case the window or a modal child will have been focused . ) */
meta_workspace_focus_default_window ( workspace_manager - > active_workspace ,
NULL ,
timestamp ) ;
}
2008-11-20 04:14:58 -05:00
/*
* Move window to the requested workspace ; append controls whether new WS
* should be created if one does not exist .
*/
void
meta_window_change_workspace_by_index ( MetaWindow * window ,
gint space_index ,
2013-10-09 15:36:51 -04:00
gboolean append )
2008-11-20 04:14:58 -05:00
{
2017-08-27 15:02:40 -04:00
MetaWorkspaceManager * workspace_manager ;
2008-11-20 04:14:58 -05:00
MetaWorkspace * workspace ;
2017-08-26 15:39:46 -04:00
MetaDisplay * display ;
2008-11-20 04:14:58 -05:00
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2008-11-20 04:14:58 -05:00
if ( space_index = = - 1 )
{
meta_window_stick ( window ) ;
return ;
}
2017-08-26 15:39:46 -04:00
display = window - > display ;
2017-08-27 15:02:40 -04:00
workspace_manager = display - > workspace_manager ;
2008-11-20 04:14:58 -05:00
workspace =
2017-08-27 15:02:40 -04:00
meta_workspace_manager_get_workspace_by_index ( workspace_manager , space_index ) ;
2008-11-20 04:14:58 -05:00
if ( ! workspace & & append )
2017-08-27 15:02:40 -04:00
workspace = meta_workspace_manager_append_new_workspace ( workspace_manager , FALSE , META_CURRENT_TIME ) ;
2008-11-20 04:14:58 -05:00
if ( workspace )
2015-06-25 10:46:17 -04:00
meta_window_change_workspace ( window , workspace ) ;
2008-11-20 04:14:58 -05:00
}
2001-06-02 21:33:27 -04:00
2019-10-12 14:55:26 -04:00
void
meta_window_update_appears_focused ( MetaWindow * window )
2011-10-26 14:00:18 -04:00
{
2019-10-12 14:55:26 -04:00
MetaWorkspaceManager * workspace_manager ;
MetaWorkspace * workspace ;
gboolean appears_focused ;
workspace_manager = window - > display - > workspace_manager ;
workspace = meta_window_get_workspace ( window ) ;
if ( workspace & & workspace ! = workspace_manager - > active_workspace )
2022-07-11 18:45:43 -04:00
{
appears_focused =
window = = meta_workspace_get_default_focus_window ( workspace , NULL ) & &
meta_prefs_get_focus_mode ( ) = = G_DESKTOP_FOCUS_MODE_CLICK ;
}
2019-10-12 14:55:26 -04:00
else
2022-07-11 18:45:43 -04:00
{
appears_focused = window - > has_focus | | window - > attached_focus_window ;
}
2019-10-12 14:55:26 -04:00
if ( window - > appears_focused = = appears_focused )
return ;
window - > appears_focused = appears_focused ;
2011-10-26 14:00:18 -04:00
set_net_wm_state ( window ) ;
2013-11-15 17:37:50 -05:00
meta_window_frame_size_changed ( window ) ;
2011-10-26 14:00:18 -04:00
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_APPEARS_FOCUSED ] ) ;
2011-10-26 14:00:18 -04:00
}
2014-10-06 19:55:01 -04:00
static gboolean
should_propagate_focus_appearance ( MetaWindow * window )
{
2014-08-13 18:38:30 -04:00
/* Parents of attached modal dialogs should appear focused. */
2014-10-06 19:55:01 -04:00
if ( meta_window_is_attached_dialog ( window ) )
return TRUE ;
2014-08-13 18:38:30 -04:00
/* Parents of these sorts of override-redirect windows should
* appear focused . */
2014-10-06 19:55:01 -04:00
switch ( window - > type )
{
case META_WINDOW_DROPDOWN_MENU :
case META_WINDOW_POPUP_MENU :
case META_WINDOW_COMBO :
2014-08-13 18:38:30 -04:00
case META_WINDOW_TOOLTIP :
case META_WINDOW_NOTIFICATION :
case META_WINDOW_DND :
case META_WINDOW_OVERRIDE_OTHER :
2014-10-06 19:55:01 -04:00
return TRUE ;
default :
break ;
}
return FALSE ;
}
2011-04-13 17:08:12 -04:00
/**
* meta_window_propagate_focus_appearance :
* @ window : the window to start propagating from
* @ focused : % TRUE if @ window ' s ancestors should appear focused ,
* % FALSE if they should not .
*
* Adjusts the value of # MetaWindow : appears - focused on @ window ' s
* ancestors ( but not @ window itself ) . If @ focused is % TRUE , each of
* @ window ' s ancestors will have its % attached_focus_window field set
* to the current % focus_window . If @ focused if % FALSE , each of
* @ window ' s ancestors will have its % attached_focus_window field
* cleared if it is currently % focus_window .
*/
2014-05-20 13:56:41 -04:00
static void
2011-03-24 21:36:47 -04:00
meta_window_propagate_focus_appearance ( MetaWindow * window ,
gboolean focused )
2010-09-10 05:55:20 -04:00
{
2011-04-13 17:08:12 -04:00
MetaWindow * child , * parent , * focus_window ;
2010-09-10 05:55:20 -04:00
2011-04-13 17:08:12 -04:00
focus_window = window - > display - > focus_window ;
2011-03-24 21:36:47 -04:00
child = window ;
parent = meta_window_get_transient_for ( child ) ;
2014-10-06 19:55:01 -04:00
while ( parent & & ( ! focused | | should_propagate_focus_appearance ( child ) ) )
2011-03-24 21:36:47 -04:00
{
gboolean child_focus_state_changed ;
2010-09-10 05:55:20 -04:00
2011-03-24 21:36:47 -04:00
if ( focused )
{
2011-04-13 17:08:12 -04:00
if ( parent - > attached_focus_window = = focus_window )
2011-03-24 21:36:47 -04:00
break ;
child_focus_state_changed = ( parent - > attached_focus_window = = NULL ) ;
2011-04-13 17:08:12 -04:00
parent - > attached_focus_window = focus_window ;
2011-03-24 21:36:47 -04:00
}
else
{
2011-04-13 17:08:12 -04:00
if ( parent - > attached_focus_window ! = focus_window )
2011-03-24 21:36:47 -04:00
break ;
child_focus_state_changed = ( parent - > attached_focus_window ! = NULL ) ;
parent - > attached_focus_window = NULL ;
}
2011-04-26 08:12:04 -04:00
if ( child_focus_state_changed & & ! parent - > has_focus )
2011-03-24 21:36:47 -04:00
{
2019-10-12 14:55:26 -04:00
meta_window_update_appears_focused ( parent ) ;
2011-03-24 21:36:47 -04:00
}
child = parent ;
parent = meta_window_get_transient_for ( child ) ;
}
2010-09-10 05:55:20 -04:00
}
2011-04-26 08:12:04 -04:00
void
2012-12-16 21:24:32 -05:00
meta_window_set_focused_internal ( MetaWindow * window ,
gboolean focused )
2012-12-16 21:22:05 -05:00
{
2012-12-16 21:24:32 -05:00
if ( focused )
2012-12-16 21:22:05 -05:00
{
2012-12-16 22:24:15 -05:00
window - > has_focus = TRUE ;
2013-05-01 17:37:50 -04:00
if ( window - > override_redirect )
return ;
2012-12-16 22:24:15 -05:00
/* Ungrab click to focus button since the sync grab can interfere
* with some things you might do inside the focused window , by
* causing the client to get funky enter / leave events .
*
* The reason we usually have a passive grab on the window is
* so that we can intercept clicks and raise the window in
* response . For click - to - focus we don ' t need that since the
* focused window is already raised . When raise_on_click is
* FALSE we also don ' t need that since we don ' t do anything
* when the window is clicked .
*
* There is dicussion in bugs 102209 , 115072 , and 461577
*/
if ( meta_prefs_get_focus_mode ( ) = = G_DESKTOP_FOCUS_MODE_CLICK | |
! meta_prefs_get_raise_on_click ( ) )
2016-02-10 14:17:49 -05:00
{
meta_display_ungrab_focus_window_button ( window - > display , window ) ;
/* Since we ungrab with XIAnyModifier above, all button
grabs go way so we need to re - grab the window buttons . */
meta_display_grab_window_buttons ( window - > display , window - > xwindow ) ;
}
2012-12-16 21:22:05 -05:00
2012-12-16 22:24:15 -05:00
g_signal_emit ( window , window_signals [ FOCUS ] , 0 ) ;
2012-12-16 21:22:05 -05:00
2012-12-16 22:24:15 -05:00
if ( ! window - > attached_focus_window )
2019-10-12 14:55:26 -04:00
meta_window_update_appears_focused ( window ) ;
2012-12-16 21:22:05 -05:00
2012-12-16 22:24:15 -05:00
meta_window_propagate_focus_appearance ( window , TRUE ) ;
2012-12-16 21:22:05 -05:00
}
2012-12-16 21:24:32 -05:00
else
2012-11-15 16:35:42 -05:00
{
2012-12-16 22:24:15 -05:00
window - > has_focus = FALSE ;
2013-05-01 17:37:50 -04:00
if ( window - > override_redirect )
return ;
meta_window_propagate_focus_appearance ( window , FALSE ) ;
2012-11-15 16:35:42 -05:00
2012-12-16 22:24:15 -05:00
if ( ! window - > attached_focus_window )
2019-10-12 14:55:26 -04:00
meta_window_update_appears_focused ( window ) ;
2012-11-15 16:35:42 -05:00
2012-12-16 22:24:15 -05:00
/* Re-grab for click to focus and raise-on-click, if necessary */
if ( meta_prefs_get_focus_mode ( ) = = G_DESKTOP_FOCUS_MODE_CLICK | |
! meta_prefs_get_raise_on_click ( ) )
meta_display_grab_focus_window_button ( window - > display , window ) ;
2012-11-15 16:35:42 -05:00
}
}
2009-03-31 17:29:48 -04:00
/**
* meta_window_get_icon_geometry :
* @ window : a # MetaWindow
2013-01-20 15:35:32 -05:00
* @ rect : ( out ) : rectangle into which to store the returned geometry .
2009-03-31 17:29:48 -04:00
*
* Gets the location of the icon corresponding to the window . The location
* will be provided set by the task bar or other user interface element
2013-02-01 05:32:53 -05:00
* displaying the icon , and is relative to the root window .
2009-03-31 17:29:48 -04:00
*
2020-08-26 05:49:50 -04:00
* Return value : % TRUE if the icon geometry was successfully retrieved .
2009-03-31 17:29:48 -04:00
*/
2002-10-24 01:21:51 -04:00
gboolean
2001-08-05 12:04:52 -04:00
meta_window_get_icon_geometry ( MetaWindow * window ,
MetaRectangle * rect )
{
2009-06-14 08:37:57 -04:00
g_return_val_if_fail ( ! window - > override_redirect , FALSE ) ;
2013-02-01 05:32:53 -05:00
if ( window - > icon_geometry_set )
2001-08-19 21:42:44 -04:00
{
2002-01-03 19:58:39 -05:00
if ( rect )
2013-02-01 05:32:53 -05:00
* rect = window - > icon_geometry ;
2001-08-05 12:04:52 -04:00
2002-01-03 19:58:39 -05:00
return TRUE ;
}
return FALSE ;
2001-08-05 12:04:52 -04:00
}
2013-01-22 19:11:23 -05:00
/**
* meta_window_set_icon_geometry :
* @ window : a # MetaWindow
2014-05-28 15:44:23 -04:00
* @ rect : ( nullable ) : rectangle with the desired geometry or % NULL .
2013-01-22 19:11:23 -05:00
*
* Sets or unsets the location of the icon corresponding to the window . If
* set , the location should correspond to a dock , task bar or other user
* interface element displaying the icon , and is relative to the root window .
*/
void
meta_window_set_icon_geometry ( MetaWindow * window ,
MetaRectangle * rect )
{
if ( rect )
{
window - > icon_geometry = * rect ;
window - > icon_geometry_set = TRUE ;
}
else
{
window - > icon_geometry_set = FALSE ;
}
}
2022-01-28 18:02:24 -05:00
cairo_surface_t *
meta_window_get_icon ( MetaWindow * window )
2003-02-27 20:24:44 -05:00
{
2022-01-28 18:02:24 -05:00
MetaWindowClass * klass = META_WINDOW_GET_CLASS ( window ) ;
2003-02-27 20:24:44 -05:00
2022-01-28 18:02:24 -05:00
if ( klass - > get_icon )
return klass - > get_icon ( window ) ;
else
return NULL ;
2001-06-23 22:22:10 -04:00
}
2022-01-28 18:02:24 -05:00
cairo_surface_t *
meta_window_get_mini_icon ( MetaWindow * window )
2002-05-24 04:16:59 -04:00
{
2022-01-28 18:02:24 -05:00
MetaWindowClass * klass = META_WINDOW_GET_CLASS ( window ) ;
2003-02-27 20:24:44 -05:00
2022-01-28 18:02:24 -05:00
if ( klass - > get_mini_icon )
return klass - > get_mini_icon ( window ) ;
else
return NULL ;
2003-02-27 20:24:44 -05:00
}
2003-06-25 23:09:38 -04:00
GList *
2002-01-10 01:31:31 -05:00
meta_window_get_workspaces ( MetaWindow * window )
{
2017-08-27 15:02:40 -04:00
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
2002-01-10 01:31:31 -05:00
if ( window - > on_all_workspaces )
2017-08-27 15:02:40 -04:00
return workspace_manager - > workspaces ;
2012-03-13 00:37:31 -04:00
else if ( window - > workspace ! = NULL )
2006-02-11 00:06:08 -05:00
return window - > workspace - > list_containing_self ;
2014-08-16 13:22:05 -04:00
else if ( window - > constructing )
2012-03-13 00:37:31 -04:00
return NULL ;
2014-08-16 13:22:05 -04:00
else
g_assert_not_reached ( ) ;
2019-01-24 18:47:44 -05:00
return NULL ;
2002-01-10 01:31:31 -05:00
}
static void
invalidate_work_areas ( MetaWindow * window )
{
GList * tmp ;
tmp = meta_window_get_workspaces ( window ) ;
2008-12-18 07:41:56 -05:00
2002-01-10 01:31:31 -05:00
while ( tmp ! = NULL )
{
meta_workspace_invalidate_work_area ( tmp - > data ) ;
tmp = tmp - > next ;
}
}
2003-06-25 23:09:38 -04:00
void
meta_window_update_struts ( MetaWindow * window )
2002-01-10 01:31:31 -05:00
{
2014-04-28 17:06:38 -04:00
if ( META_WINDOW_GET_CLASS ( window ) - > update_struts ( window ) )
invalidate_work_areas ( window ) ;
2002-01-10 01:31:31 -05:00
}
2014-03-13 16:52:31 -04:00
static void
2013-09-10 09:53:31 -04:00
meta_window_type_changed ( MetaWindow * window )
{
gboolean old_decorated = window - > decorated ;
GObject * object = G_OBJECT ( window ) ;
2008-12-18 07:41:56 -05:00
2013-09-10 09:53:31 -04:00
window - > attached = meta_window_should_attach_to_parent ( window ) ;
2014-02-01 18:58:58 -05:00
meta_window_recalc_features ( window ) ;
2008-12-18 07:41:56 -05:00
2013-09-10 09:53:31 -04:00
if ( ! window - > override_redirect )
set_net_wm_state ( window ) ;
2008-12-18 07:41:56 -05:00
2013-09-10 09:53:31 -04:00
/* Update frame */
if ( window - > decorated )
meta_window_ensure_frame ( window ) ;
else
meta_window_destroy_frame ( window ) ;
2003-02-27 17:44:36 -05:00
2013-09-10 09:53:31 -04:00
/* update stacking constraints */
meta_window_update_layer ( window ) ;
meta_window_grab_keys ( window ) ;
2009-02-11 07:16:41 -05:00
2013-09-10 09:53:31 -04:00
g_object_freeze_notify ( object ) ;
2009-08-04 03:06:30 -04:00
2013-09-10 09:53:31 -04:00
if ( old_decorated ! = window - > decorated )
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_DECORATED ] ) ;
2009-08-04 03:06:30 -04:00
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_WINDOW_TYPE ] ) ;
2009-08-04 03:06:30 -04:00
2013-09-10 09:53:31 -04:00
g_object_thaw_notify ( object ) ;
2001-06-09 23:17:15 -04:00
}
2014-03-13 16:52:31 -04:00
void
meta_window_set_type ( MetaWindow * window ,
MetaWindowType type )
{
if ( window - > type = = type )
return ;
window - > type = type ;
meta_window_type_changed ( window ) ;
}
2013-11-15 17:37:50 -05:00
void
meta_window_frame_size_changed ( MetaWindow * window )
{
if ( window - > frame )
meta_frame_clear_cached_borders ( window - > frame ) ;
}
2014-03-18 11:20:22 -04:00
static void
meta_window_get_default_skip_hints ( MetaWindow * window ,
gboolean * skip_taskbar_out ,
gboolean * skip_pager_out )
{
META_WINDOW_GET_CLASS ( window ) - > get_default_skip_hints ( window , skip_taskbar_out , skip_pager_out ) ;
}
2014-03-18 11:10:22 -04:00
static void
meta_window_recalc_skip_features ( MetaWindow * window )
{
switch ( window - > type )
{
/* Force skip taskbar/pager on these window types */
case META_WINDOW_DESKTOP :
case META_WINDOW_DOCK :
case META_WINDOW_TOOLBAR :
case META_WINDOW_MENU :
case META_WINDOW_UTILITY :
case META_WINDOW_SPLASHSCREEN :
case META_WINDOW_DROPDOWN_MENU :
case META_WINDOW_POPUP_MENU :
case META_WINDOW_TOOLTIP :
case META_WINDOW_NOTIFICATION :
case META_WINDOW_COMBO :
case META_WINDOW_DND :
case META_WINDOW_OVERRIDE_OTHER :
window - > skip_taskbar = TRUE ;
window - > skip_pager = TRUE ;
break ;
case META_WINDOW_DIALOG :
case META_WINDOW_MODAL_DIALOG :
/* only skip taskbar if we have a real transient parent
( and ignore the application hints ) */
if ( window - > transient_for ! = NULL )
window - > skip_taskbar = TRUE ;
else
wayland: Add API to launch trusted clients
Allowing code from inside mutter to create a child process and
delegate on it some of its tasks is something very useful. This can
be done easily with the g_subprocess and g_subprocess_launcher classes
already available in GLib and GObject.
Unfortunately, although the child process can be a graphical program,
currently it is not possible for the inner code to identify the
windows created by the child in a secure manner (this is: being able
to ensure that a malicious program won't be able to trick the inner
code into thinking it is a child process launched by it).
Under X11 this is not a problem because any program has full control
over their windows, but under Wayland it is a different story: a
program can't neither force their window to be kept at the top (like a
docker program does) or at the bottom (like a program for desktop icons
does), nor hide it from the list of windows. This means that it is not
possible for a "classic", non-priviledged program, to fulfill these
tasks, and it can be done only from code inside mutter (like a
gnome-shell extension).
This is a non desirable situation, because an extension runs in the
same main loop than the whole desktop itself, which means that a
complex extension can need to do too much work inside the main loop,
and freeze the whole desktop for too much time. Also, it is important
to note that javascript doesn't have access to fork(), or threads,
which means that, at most, all the parallel computing that can do is
those available in the _async calls in GLib/GObject.
Also, having to create an extension for any priviledged graphical
element is an stopper for a lot of programmers who already know
GTK+ but doesn't know Clutter.
This patch wants to offer a solution to this problem, by offering a
new class that allows to launch a trusted child process from inside
mutter, and make it to use an specific UNIX socket to communicate
with the compositor. It also allows to check whether an specific
MetaWindow was created by one of this trusted child processes or not.
This allows to create extensions that launch a child process, and
when that process creates a window, the extension can confirm in a
secure way that the window really belongs to that process
launched by it, so it can give to that window "superpowers" like
being kept at the bottom of the desktop, not being listed in the
list of windows or shown in the Activities panel... Also, in future
versions, it could easily implement protocol extensions that only
could be used by these trusted child processes.
Several examples of the usefulness of this are that, with it, it
is possible to write programs that implements:
- desktop icons
- a dock
- a top or bottom bar
...
all in a secure manner, avoiding insecure programs to do the same.
In fact, even if the same code is launched manually, it won't have
those privileges, only the specific process launched from inside
mutter.
Since this is only needed under Wayland, it won't work under X11.
Fixes https://gitlab.gnome.org/GNOME/mutter/issues/741
2020-08-04 04:42:29 -04:00
window - > skip_taskbar = window - > skip_from_window_list ;
2014-03-18 11:10:22 -04:00
break ;
case META_WINDOW_NORMAL :
2014-03-18 11:20:22 -04:00
{
gboolean skip_taskbar_hint , skip_pager_hint ;
meta_window_get_default_skip_hints ( window , & skip_taskbar_hint , & skip_pager_hint ) ;
wayland: Add API to launch trusted clients
Allowing code from inside mutter to create a child process and
delegate on it some of its tasks is something very useful. This can
be done easily with the g_subprocess and g_subprocess_launcher classes
already available in GLib and GObject.
Unfortunately, although the child process can be a graphical program,
currently it is not possible for the inner code to identify the
windows created by the child in a secure manner (this is: being able
to ensure that a malicious program won't be able to trick the inner
code into thinking it is a child process launched by it).
Under X11 this is not a problem because any program has full control
over their windows, but under Wayland it is a different story: a
program can't neither force their window to be kept at the top (like a
docker program does) or at the bottom (like a program for desktop icons
does), nor hide it from the list of windows. This means that it is not
possible for a "classic", non-priviledged program, to fulfill these
tasks, and it can be done only from code inside mutter (like a
gnome-shell extension).
This is a non desirable situation, because an extension runs in the
same main loop than the whole desktop itself, which means that a
complex extension can need to do too much work inside the main loop,
and freeze the whole desktop for too much time. Also, it is important
to note that javascript doesn't have access to fork(), or threads,
which means that, at most, all the parallel computing that can do is
those available in the _async calls in GLib/GObject.
Also, having to create an extension for any priviledged graphical
element is an stopper for a lot of programmers who already know
GTK+ but doesn't know Clutter.
This patch wants to offer a solution to this problem, by offering a
new class that allows to launch a trusted child process from inside
mutter, and make it to use an specific UNIX socket to communicate
with the compositor. It also allows to check whether an specific
MetaWindow was created by one of this trusted child processes or not.
This allows to create extensions that launch a child process, and
when that process creates a window, the extension can confirm in a
secure way that the window really belongs to that process
launched by it, so it can give to that window "superpowers" like
being kept at the bottom of the desktop, not being listed in the
list of windows or shown in the Activities panel... Also, in future
versions, it could easily implement protocol extensions that only
could be used by these trusted child processes.
Several examples of the usefulness of this are that, with it, it
is possible to write programs that implements:
- desktop icons
- a dock
- a top or bottom bar
...
all in a secure manner, avoiding insecure programs to do the same.
In fact, even if the same code is launched manually, it won't have
those privileges, only the specific process launched from inside
mutter.
Since this is only needed under Wayland, it won't work under X11.
Fixes https://gitlab.gnome.org/GNOME/mutter/issues/741
2020-08-04 04:42:29 -04:00
window - > skip_taskbar = skip_taskbar_hint | window - > skip_from_window_list ;
window - > skip_pager = skip_pager_hint | window - > skip_from_window_list ;
2014-03-18 11:20:22 -04:00
}
2014-03-18 11:10:22 -04:00
break ;
}
}
2003-02-27 20:24:44 -05:00
void
meta_window_recalc_features ( MetaWindow * window )
2001-06-23 14:30:27 -04:00
{
2002-08-01 19:52:47 -04:00
gboolean old_has_close_func ;
gboolean old_has_minimize_func ;
gboolean old_has_move_func ;
gboolean old_has_resize_func ;
gboolean old_has_shade_func ;
gboolean old_always_sticky ;
2014-01-30 16:39:54 -05:00
gboolean old_skip_taskbar ;
2002-08-01 19:52:47 -04:00
old_has_close_func = window - > has_close_func ;
old_has_minimize_func = window - > has_minimize_func ;
old_has_move_func = window - > has_move_func ;
old_has_resize_func = window - > has_resize_func ;
old_has_shade_func = window - > has_shade_func ;
old_always_sticky = window - > always_sticky ;
2014-01-30 16:39:54 -05:00
old_skip_taskbar = window - > skip_taskbar ;
2002-08-01 19:52:47 -04:00
2001-06-23 14:30:27 -04:00
/* Use MWM hints initially */
2013-09-10 09:53:31 -04:00
if ( window - > client_type = = META_WINDOW_CLIENT_TYPE_X11 )
window - > decorated = window - > mwm_decorated ;
else
window - > decorated = FALSE ;
2002-06-21 23:23:02 -04:00
window - > border_only = window - > mwm_border_only ;
2001-06-23 14:30:27 -04:00
window - > has_close_func = window - > mwm_has_close_func ;
window - > has_minimize_func = window - > mwm_has_minimize_func ;
window - > has_maximize_func = window - > mwm_has_maximize_func ;
window - > has_move_func = window - > mwm_has_move_func ;
2008-12-18 07:41:56 -05:00
window - > has_resize_func = TRUE ;
2002-08-24 16:54:23 -04:00
/* If min_size == max_size, then don't allow resize */
if ( window - > size_hints . min_width = = window - > size_hints . max_width & &
window - > size_hints . min_height = = window - > size_hints . max_height )
window - > has_resize_func = FALSE ;
else if ( ! window - > mwm_has_resize_func )
{
/* We ignore mwm_has_resize_func because WM_NORMAL_HINTS is the
* authoritative source for that info . Some apps such as mplayer or
* xine disable resize via MWM but not WM_NORMAL_HINTS , but that
* leads to e . g . us not fullscreening their windows . Apps that set
* MWM but not WM_NORMAL_HINTS are basically broken . We complain
* about these apps but make them work .
*/
2008-12-18 07:41:56 -05:00
2020-10-02 11:47:22 -04:00
meta_warning ( " Window %s sets an MWM hint indicating it isn't resizable, but sets min size %d x %d and max size %d x %d; this doesn't make much sense. " ,
2002-08-24 16:54:23 -04:00
window - > desc ,
window - > size_hints . min_width ,
window - > size_hints . min_height ,
window - > size_hints . max_width ,
window - > size_hints . max_height ) ;
}
2001-06-23 14:30:27 -04:00
window - > has_shade_func = TRUE ;
2002-02-23 17:58:02 -05:00
window - > has_fullscreen_func = TRUE ;
2002-05-26 11:54:38 -04:00
window - > always_sticky = FALSE ;
2008-12-18 07:41:56 -05:00
2001-06-23 14:30:27 -04:00
/* Semantic category overrides the MWM hints */
2002-04-30 23:23:46 -04:00
if ( window - > type = = META_WINDOW_TOOLBAR )
window - > decorated = FALSE ;
2002-05-26 11:54:38 -04:00
if ( window - > type = = META_WINDOW_DESKTOP | |
2008-11-23 14:28:40 -05:00
window - > type = = META_WINDOW_DOCK | |
window - > override_redirect )
2002-05-26 11:54:38 -04:00
window - > always_sticky = TRUE ;
2008-12-18 07:41:56 -05:00
2011-10-17 11:42:35 -04:00
if ( window - > override_redirect | |
meta_window_get_frame_type ( window ) = = META_FRAME_TYPE_LAST )
2001-06-23 14:30:27 -04:00
{
2001-07-30 23:59:55 -04:00
window - > decorated = FALSE ;
2001-06-23 14:30:27 -04:00
window - > has_close_func = FALSE ;
window - > has_shade_func = FALSE ;
2002-04-30 23:23:46 -04:00
/* FIXME this keeps panels and things from using
* NET_WM_MOVERESIZE ; the problem is that some
* panels ( edge panels ) have fixed possible locations ,
* and others ( " floating panels " ) do not .
*
* Perhaps we should require edge panels to explicitly
* disable movement ?
*/
2001-06-23 14:30:27 -04:00
window - > has_move_func = FALSE ;
window - > has_resize_func = FALSE ;
}
2008-12-18 07:41:56 -05:00
2001-06-23 14:30:27 -04:00
if ( window - > type ! = META_WINDOW_NORMAL )
{
window - > has_minimize_func = FALSE ;
window - > has_maximize_func = FALSE ;
2002-02-23 17:58:02 -05:00
window - > has_fullscreen_func = FALSE ;
2001-06-23 14:30:27 -04:00
}
2001-08-03 00:20:27 -04:00
if ( ! window - > has_resize_func )
2008-12-18 07:41:56 -05:00
{
2002-02-23 17:58:02 -05:00
window - > has_maximize_func = FALSE ;
2017-08-27 14:44:38 -04:00
MetaRectangle display_rect = { 0 } ;
meta_display_get_size ( window - > display , & display_rect . width ,
& display_rect . height ) ;
2008-12-18 07:41:56 -05:00
2002-08-24 16:54:23 -04:00
/* don't allow fullscreen if we can't resize, unless the size
* is entire screen size ( kind of broken , because we
2009-08-31 09:52:16 -04:00
* actually fullscreen to monitor size not screen size )
2002-08-24 16:54:23 -04:00
*/
2017-08-27 14:44:38 -04:00
if ( window - > size_hints . min_width = = display_rect . width & &
window - > size_hints . min_height = = display_rect . height )
2002-08-15 01:14:49 -04:00
; /* leave fullscreen available */
else
window - > has_fullscreen_func = FALSE ;
2002-09-22 21:43:20 -04:00
}
2002-08-24 16:54:23 -04:00
2002-09-22 21:43:20 -04:00
/* We leave fullscreen windows decorated, just push the frame outside
* the screen . This avoids flickering to unparent them .
*
* Note that setting has_resize_func = FALSE here must come after the
* above code that may disable fullscreen , because if the window
* is not resizable purely due to fullscreen , we don ' t want to
* disable fullscreen mode .
*/
if ( window - > fullscreen )
{
window - > has_shade_func = FALSE ;
window - > has_move_func = FALSE ;
window - > has_resize_func = FALSE ;
window - > has_maximize_func = FALSE ;
2002-02-23 17:58:02 -05:00
}
2001-08-03 00:20:27 -04:00
2017-08-18 02:21:11 -04:00
if ( window - > has_maximize_func & & window - > monitor )
2012-03-12 23:18:03 -04:00
{
2013-11-15 16:11:20 -05:00
MetaRectangle work_area , client_rect ;
2012-03-12 23:18:03 -04:00
meta_window_get_work_area_current_monitor ( window , & work_area ) ;
2013-11-15 16:11:20 -05:00
meta_window_frame_rect_to_client_rect ( window , & work_area , & client_rect ) ;
2012-03-12 23:18:03 -04:00
2022-08-27 05:58:51 -04:00
if ( window - > size_hints . min_width > client_rect . width | |
window - > size_hints . min_height > client_rect . height )
2012-03-12 23:18:03 -04:00
window - > has_maximize_func = FALSE ;
}
2002-09-22 21:43:20 -04:00
meta_topic ( META_DEBUG_WINDOW_OPS ,
2020-10-02 11:47:22 -04:00
" Window %s fullscreen = %d not resizable, maximizable = %d fullscreenable = %d min size %dx%d max size %dx%d " ,
2002-09-22 21:43:20 -04:00
window - > desc ,
window - > fullscreen ,
window - > has_maximize_func , window - > has_fullscreen_func ,
window - > size_hints . min_width ,
window - > size_hints . min_height ,
window - > size_hints . max_width ,
window - > size_hints . max_height ) ;
2008-12-18 07:41:56 -05:00
2001-08-03 00:20:27 -04:00
/* no shading if not decorated */
2002-07-24 22:45:38 -04:00
if ( ! window - > decorated | | window - > border_only )
2001-08-03 00:20:27 -04:00
window - > has_shade_func = FALSE ;
2002-07-06 15:05:37 -04:00
2014-03-18 11:10:22 -04:00
meta_window_recalc_skip_features ( window ) ;
2002-08-01 19:52:47 -04:00
2015-11-16 18:31:55 -05:00
/* To prevent users from losing windows, let's prevent users from
* minimizing skip - taskbar windows through the window decorations . */
if ( window - > skip_taskbar )
window - > has_minimize_func = FALSE ;
2002-09-22 21:43:20 -04:00
meta_topic ( META_DEBUG_WINDOW_OPS ,
2020-10-02 11:47:22 -04:00
" Window %s decorated = %d border_only = %d has_close = %d has_minimize = %d has_maximize = %d has_move = %d has_shade = %d skip_taskbar = %d skip_pager = %d " ,
2002-09-22 21:43:20 -04:00
window - > desc ,
window - > decorated ,
window - > border_only ,
window - > has_close_func ,
window - > has_minimize_func ,
window - > has_maximize_func ,
window - > has_move_func ,
window - > has_shade_func ,
window - > skip_taskbar ,
window - > skip_pager ) ;
2008-12-18 07:41:56 -05:00
2014-01-30 16:39:54 -05:00
if ( old_skip_taskbar ! = window - > skip_taskbar )
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_SKIP_TASKBAR ] ) ;
2014-01-30 16:39:54 -05:00
2002-08-01 19:52:47 -04:00
/* FIXME:
2014-02-01 18:58:58 -05:00
* Lame workaround for recalc_features being used overzealously .
* The fix is to only recalc_features when something has
* actually changed .
2002-08-01 19:52:47 -04:00
*/
2007-04-10 22:37:30 -04:00
if ( window - > constructing | |
old_has_close_func ! = window - > has_close_func | |
2002-08-01 19:52:47 -04:00
old_has_minimize_func ! = window - > has_minimize_func | |
old_has_move_func ! = window - > has_move_func | |
old_has_resize_func ! = window - > has_resize_func | |
old_has_shade_func ! = window - > has_shade_func | |
old_always_sticky ! = window - > always_sticky )
set_allowed_actions_hint ( window ) ;
2008-12-18 07:41:56 -05:00
2011-07-02 07:08:17 -04:00
if ( window - > has_resize_func ! = old_has_resize_func )
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_RESIZEABLE ] ) ;
2011-07-02 07:08:17 -04:00
2013-11-15 17:37:50 -05:00
meta_window_frame_size_changed ( window ) ;
2001-06-23 14:30:27 -04:00
/* FIXME perhaps should ensure if we don't have a shade func,
* we aren ' t shaded , etc .
*/
}
2001-06-23 01:49:35 -04:00
void
2014-05-23 17:14:51 -04:00
meta_window_show_menu ( MetaWindow * window ,
MetaWindowMenuType menu ,
int x ,
int y )
2014-03-13 18:34:14 -04:00
{
2009-06-14 08:11:29 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
2014-05-23 17:14:51 -04:00
meta_compositor_show_window_menu ( window - > display - > compositor , window , menu , x , y ) ;
2001-06-23 01:49:35 -04:00
}
2001-06-24 04:09:10 -04:00
2014-05-30 18:52:06 -04:00
void
meta_window_show_menu_for_rect ( MetaWindow * window ,
MetaWindowMenuType menu ,
MetaRectangle * rect )
{
g_return_if_fail ( ! window - > override_redirect ) ;
meta_compositor_show_window_menu_for_rect ( window - > display - > compositor , window , menu , rect ) ;
}
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
void
meta_window_shove_titlebar_onscreen ( MetaWindow * window )
{
2017-08-27 15:02:40 -04:00
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
2013-11-19 12:24:45 -05:00
MetaRectangle frame_rect ;
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
GList * onscreen_region ;
int horiz_amount , vert_amount ;
2009-06-15 18:25:07 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
/* If there's no titlebar, don't bother */
if ( ! window - > frame )
return ;
/* Get the basic info we need */
2013-11-19 12:24:45 -05:00
meta_window_get_frame_rect ( window , & frame_rect ) ;
2017-08-27 15:02:40 -04:00
onscreen_region = workspace_manager - > active_workspace - > screen_region ;
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
/* Extend the region (just in case the window is too big to fit on the
* screen ) , then shove the window on screen , then return the region to
* normal .
*/
2013-11-19 12:24:45 -05:00
horiz_amount = frame_rect . width ;
vert_amount = frame_rect . height ;
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
meta_rectangle_expand_region ( onscreen_region ,
horiz_amount ,
2008-12-18 07:41:56 -05:00
horiz_amount ,
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
0 ,
vert_amount ) ;
meta_rectangle_shove_into_region ( onscreen_region ,
FIXED_DIRECTION_X ,
2013-11-19 12:24:45 -05:00
& frame_rect ) ;
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
meta_rectangle_expand_region ( onscreen_region ,
- horiz_amount ,
2008-12-18 07:41:56 -05:00
- horiz_amount ,
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
0 ,
- vert_amount ) ;
2014-05-21 08:51:24 -04:00
meta_window_move_frame ( window , FALSE , frame_rect . x , frame_rect . y ) ;
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
}
gboolean
meta_window_titlebar_is_onscreen ( MetaWindow * window )
{
2017-08-27 15:02:40 -04:00
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
2014-09-18 11:29:50 -04:00
MetaRectangle titlebar_rect , frame_rect ;
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
GList * onscreen_region ;
gboolean is_onscreen ;
const int min_height_needed = 8 ;
2013-12-19 10:56:31 -05:00
const float min_width_percent = 0.5 ;
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
const int min_width_absolute = 50 ;
/* Titlebar can't be offscreen if there is no titlebar... */
if ( ! window - > frame )
2014-03-05 19:40:09 -05:00
return TRUE ;
2008-12-18 07:41:56 -05:00
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
/* Get the rectangle corresponding to the titlebar */
2014-05-22 16:48:58 -04:00
meta_window_get_titlebar_rect ( window , & titlebar_rect ) ;
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
2014-09-18 11:29:50 -04:00
/* Translate into screen coordinates */
meta_window_get_frame_rect ( window , & frame_rect ) ;
titlebar_rect . x = frame_rect . x ;
titlebar_rect . y = frame_rect . y ;
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
/* Run through the spanning rectangles for the screen and see if one of
* them overlaps with the titlebar sufficiently to consider it onscreen .
*/
is_onscreen = FALSE ;
2017-08-27 15:02:40 -04:00
onscreen_region = workspace_manager - > active_workspace - > screen_region ;
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
while ( onscreen_region )
{
MetaRectangle * spanning_rect = onscreen_region - > data ;
MetaRectangle overlap ;
2008-12-18 07:41:56 -05:00
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
meta_rectangle_intersect ( & titlebar_rect , spanning_rect , & overlap ) ;
if ( overlap . height > MIN ( titlebar_rect . height , min_height_needed ) & &
2008-12-18 07:41:56 -05:00
overlap . width > MIN ( titlebar_rect . width * min_width_percent ,
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
min_width_absolute ) )
{
is_onscreen = TRUE ;
break ;
}
2008-12-18 07:41:56 -05:00
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
onscreen_region = onscreen_region - > next ;
}
return is_onscreen ;
}
2016-11-28 22:48:52 -05:00
void
meta_window_get_work_area_for_logical_monitor ( MetaWindow * window ,
MetaLogicalMonitor * logical_monitor ,
MetaRectangle * area )
2002-01-10 01:31:31 -05:00
{
2008-12-18 07:41:56 -05:00
GList * tmp ;
2016-11-28 22:48:52 -05:00
g_assert ( logical_monitor ) ;
2016-11-28 07:11:24 -05:00
2009-08-31 09:52:16 -04:00
/* Initialize to the whole monitor */
2016-11-28 22:48:52 -05:00
* area = logical_monitor - > rect ;
2008-12-18 07:41:56 -05:00
tmp = meta_window_get_workspaces ( window ) ;
2002-01-10 01:31:31 -05:00
while ( tmp ! = NULL )
{
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
MetaRectangle workspace_work_area ;
2016-11-28 22:48:52 -05:00
meta_workspace_get_work_area_for_logical_monitor ( tmp - > data ,
logical_monitor ,
& workspace_work_area ) ;
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
meta_rectangle_intersect ( area ,
& workspace_work_area ,
area ) ;
2002-01-10 01:31:31 -05:00
tmp = tmp - > next ;
}
2008-12-18 07:41:56 -05:00
2002-02-07 22:34:26 -05:00
meta_topic ( META_DEBUG_WORKAREA ,
2020-10-02 11:47:22 -04:00
" Window %s monitor %d has work area %d,%d %d x %d " ,
2016-11-28 22:48:52 -05:00
window - > desc , logical_monitor - > number ,
2003-03-08 18:43:17 -05:00
area - > x , area - > y , area - > width , area - > height ) ;
2002-01-10 01:31:31 -05:00
}
2002-01-27 00:50:34 -05:00
2013-01-27 23:08:17 -05:00
/**
* meta_window_get_work_area_current_monitor :
* @ window : a # MetaWindow
* @ area : ( out ) : a location to store the work area
*
* Get the work area for the monitor @ window is currently on .
*/
2003-02-23 12:09:46 -05:00
void
2009-08-31 09:52:16 -04:00
meta_window_get_work_area_current_monitor ( MetaWindow * window ,
MetaRectangle * area )
2003-02-23 12:09:46 -05:00
{
2009-08-31 09:52:16 -04:00
meta_window_get_work_area_for_monitor ( window ,
2015-04-09 00:20:24 -04:00
window - > monitor - > number ,
2009-08-31 09:52:16 -04:00
area ) ;
2003-02-23 12:09:46 -05:00
}
2013-01-27 23:08:17 -05:00
/**
* meta_window_get_work_area_for_monitor :
* @ window : a # MetaWindow
* @ which_monitor : a moniotr to get the work area for
* @ area : ( out ) : a location to store the work area
*
* Get the work area for @ window , given the monitor index
* @ which_monitor .
*/
2003-02-23 12:09:46 -05:00
void
2009-08-31 09:52:16 -04:00
meta_window_get_work_area_for_monitor ( MetaWindow * window ,
int which_monitor ,
MetaRectangle * area )
2003-02-23 12:09:46 -05:00
{
2022-05-27 16:27:07 -04:00
MetaBackend * backend = backend_from_window ( window ) ;
2016-11-28 22:48:52 -05:00
MetaMonitorManager * monitor_manager = meta_backend_get_monitor_manager ( backend ) ;
MetaLogicalMonitor * logical_monitor ;
2009-08-31 09:52:16 -04:00
g_return_if_fail ( which_monitor > = 0 ) ;
2008-12-18 07:41:56 -05:00
2016-11-28 22:48:52 -05:00
logical_monitor =
meta_monitor_manager_get_logical_monitor_from_number ( monitor_manager ,
which_monitor ) ;
meta_window_get_work_area_for_logical_monitor ( window , logical_monitor , area ) ;
2003-03-08 18:43:17 -05:00
}
2013-01-27 23:08:17 -05:00
/**
* meta_window_get_work_area_all_monitors :
* @ window : a # MetaWindow
* @ area : ( out ) : a location to store the work area
*
* Get the work area for all monitors for @ window .
*/
2003-03-08 18:43:17 -05:00
void
2009-08-31 09:52:16 -04:00
meta_window_get_work_area_all_monitors ( MetaWindow * window ,
MetaRectangle * area )
2003-03-08 18:43:17 -05:00
{
2008-12-18 07:41:56 -05:00
GList * tmp ;
2017-08-27 14:44:38 -04:00
MetaRectangle display_rect = { 0 } ;
meta_display_get_size ( window - > display ,
& display_rect . width ,
& display_rect . height ) ;
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
2017-08-26 12:37:29 -04:00
/* Initialize to the whole display */
2017-08-27 14:44:38 -04:00
* area = display_rect ;
2008-12-18 07:41:56 -05:00
tmp = meta_window_get_workspaces ( window ) ;
2003-03-08 18:43:17 -05:00
while ( tmp ! = NULL )
{
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
MetaRectangle workspace_work_area ;
2009-08-31 09:52:16 -04:00
meta_workspace_get_work_area_all_monitors ( tmp - > data ,
& workspace_work_area ) ;
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
meta_rectangle_intersect ( area ,
& workspace_work_area ,
area ) ;
2003-03-08 18:43:17 -05:00
tmp = tmp - > next ;
}
meta_topic ( META_DEBUG_WORKAREA ,
2020-10-02 11:47:22 -04:00
" Window %s has whole-screen work area %d,%d %d x %d " ,
2003-03-08 18:43:17 -05:00
window - > desc , area - > x , area - > y , area - > width , area - > height ) ;
2003-02-23 12:09:46 -05:00
}
2016-01-10 09:16:09 -05:00
int
meta_window_get_current_tile_monitor_number ( MetaWindow * window )
{
int tile_monitor_number = window - > tile_monitor_number ;
if ( tile_monitor_number < 0 )
{
2020-10-02 11:47:22 -04:00
meta_warning ( " %s called with an invalid monitor number; using 0 instead " , G_STRFUNC ) ;
2016-01-10 09:16:09 -05:00
tile_monitor_number = 0 ;
}
return tile_monitor_number ;
}
void
2017-09-27 08:53:54 -04:00
meta_window_get_tile_area ( MetaWindow * window ,
MetaTileMode tile_mode ,
MetaRectangle * tile_area )
2016-01-10 09:16:09 -05:00
{
2017-09-27 08:37:57 -04:00
MetaRectangle work_area ;
2016-01-10 09:16:09 -05:00
int tile_monitor_number ;
2017-09-27 08:37:57 -04:00
double fraction ;
2016-01-10 09:16:09 -05:00
2017-09-27 08:53:54 -04:00
g_return_if_fail ( tile_mode ! = META_TILE_NONE ) ;
2016-01-10 09:16:09 -05:00
tile_monitor_number = meta_window_get_current_tile_monitor_number ( window ) ;
2017-09-27 08:37:57 -04:00
meta_window_get_work_area_for_monitor ( window , tile_monitor_number , & work_area ) ;
meta_window_get_tile_fraction ( window , tile_mode , & fraction ) ;
2016-01-10 09:16:09 -05:00
2017-09-27 08:37:57 -04:00
* tile_area = work_area ;
tile_area - > width = round ( tile_area - > width * fraction ) ;
2016-01-10 09:16:09 -05:00
2017-09-27 08:53:54 -04:00
if ( tile_mode = = META_TILE_RIGHT )
2017-09-27 08:37:57 -04:00
tile_area - > x + = work_area . width - tile_area - > width ;
2016-01-10 09:16:09 -05:00
}
2002-01-27 00:50:34 -05:00
gboolean
meta_window_same_application ( MetaWindow * window ,
MetaWindow * other_window )
{
2008-07-12 23:26:39 -04:00
MetaGroup * group = meta_window_get_group ( window ) ;
MetaGroup * other_group = meta_window_get_group ( other_window ) ;
2002-11-30 22:58:04 -05:00
return
2008-07-12 23:26:39 -04:00
group ! = NULL & &
other_group ! = NULL & &
group = = other_group ;
2002-01-27 00:50:34 -05:00
}
2002-03-17 12:22:23 -05:00
2014-03-05 19:01:11 -05:00
/**
* meta_window_is_client_decorated :
*
* Check if if the window has decorations drawn by the client .
* ( window - > decorated refers only to whether we should add decorations )
*/
gboolean
meta_window_is_client_decorated ( MetaWindow * window )
{
if ( window - > client_type = = META_WINDOW_CLIENT_TYPE_WAYLAND )
{
/* Assume all Wayland clients draw decorations - not strictly
* true but good enough for current purposes .
*/
return TRUE ;
}
else
{
/* Currently the implementation here is hackish -
* has_custom_frame_extents ( ) is set if _GTK_FRAME_EXTENTS is set
* to any value even 0. GTK + always sets _GTK_FRAME_EXTENTS for
* client - side - decorated window , even if the value is 0 because
* the window is maxized and has no invisible borders or shadows .
*/
return window - > has_custom_frame_extents ;
}
}
2010-04-24 17:19:25 -04:00
/**
* meta_window_foreach_transient :
* @ window : a # MetaWindow
2010-09-24 11:26:36 -04:00
* @ func : ( scope call ) ( closure user_data ) : Called for each window which is a transient of @ window ( transitively )
* @ user_data : User data
2010-04-24 17:19:25 -04:00
*
* Call @ func for every window which is either transient for @ window , or is
* a transient of a window which is in turn transient for @ window .
* The order of window enumeration is not defined .
*
* Iteration will stop if @ func at any point returns % FALSE .
*/
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
void
meta_window_foreach_transient ( MetaWindow * window ,
MetaWindowForeachFunc func ,
2010-04-24 17:19:25 -04:00
void * user_data )
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
{
GSList * windows ;
GSList * tmp ;
2009-06-15 15:32:23 -04:00
windows = meta_display_list_windows ( window - > display , META_LIST_DEFAULT ) ;
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
tmp = windows ;
while ( tmp ! = NULL )
{
MetaWindow * transient = tmp - > data ;
2008-12-18 07:41:56 -05:00
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
if ( meta_window_is_ancestor_of_transient ( window , transient ) )
2003-03-17 01:36:39 -05:00
{
2010-04-24 17:19:25 -04:00
if ( ! ( * func ) ( transient , user_data ) )
2003-03-17 01:36:39 -05:00
break ;
}
2008-12-18 07:41:56 -05:00
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
tmp = tmp - > next ;
}
g_slist_free ( windows ) ;
}
2010-04-24 17:19:25 -04:00
/**
* meta_window_foreach_ancestor :
* @ window : a # MetaWindow
2010-09-24 11:26:36 -04:00
* @ func : ( scope call ) ( closure user_data ) : Called for each window which is a transient parent of @ window
* @ user_data : User data
2010-04-24 17:19:25 -04:00
*
* If @ window is transient , call @ func with the window for which it ' s transient ,
* repeatedly until either we find a non - transient window , or @ func returns % FALSE .
*/
2003-03-17 01:36:39 -05:00
void
meta_window_foreach_ancestor ( MetaWindow * window ,
MetaWindowForeachFunc func ,
2010-04-24 17:19:25 -04:00
void * user_data )
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
{
MetaWindow * w ;
2008-12-18 07:41:56 -05:00
2003-03-17 01:36:39 -05:00
w = window ;
2011-05-06 05:09:04 -04:00
do
2003-03-17 01:36:39 -05:00
{
2013-09-16 08:44:37 -04:00
if ( w - > transient_for = = NULL )
2003-03-17 01:36:39 -05:00
break ;
2008-12-18 07:41:56 -05:00
2013-09-16 08:44:37 -04:00
w = w - > transient_for ;
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
}
2011-05-06 05:09:04 -04:00
while ( w & & ( * func ) ( w , user_data ) ) ;
2003-03-17 01:36:39 -05:00
}
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
2003-03-17 01:36:39 -05:00
typedef struct
{
MetaWindow * ancestor ;
gboolean found ;
} FindAncestorData ;
static gboolean
find_ancestor_func ( MetaWindow * window ,
void * data )
{
FindAncestorData * d = data ;
if ( window = = d - > ancestor )
{
d - > found = TRUE ;
return FALSE ;
}
return TRUE ;
}
2009-08-04 03:32:36 -04:00
/**
* meta_window_is_ancestor_of_transient :
* @ window : a # MetaWindow
* @ transient : a # MetaWindow
*
* The function determines whether @ window is an ancestor of @ transient ; it does
* so by traversing the @ transient ' s ancestors until it either locates @ window
* or reaches an ancestor that is not transient .
*
2015-09-27 16:42:01 -04:00
* Return Value : % TRUE if window is an ancestor of transient .
2009-08-04 03:32:36 -04:00
*/
2003-03-17 01:36:39 -05:00
gboolean
meta_window_is_ancestor_of_transient ( MetaWindow * window ,
MetaWindow * transient )
{
FindAncestorData d ;
d . ancestor = window ;
d . found = FALSE ;
meta_window_foreach_ancestor ( transient , find_ancestor_func , & d ) ;
return d . found ;
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
}
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
2022-10-21 13:52:35 -04:00
/**
* meta_window_begin_grab_op :
* @ window :
* @ op :
* @ device : ( nullable ) :
* @ sequence : ( nullable ) :
* @ timestamp :
* */
2022-09-29 11:13:56 -04:00
gboolean
2022-10-21 13:52:35 -04:00
meta_window_begin_grab_op ( MetaWindow * window ,
MetaGrabOp op ,
ClutterInputDevice * device ,
ClutterEventSequence * sequence ,
guint32 timestamp )
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
{
2022-10-21 06:56:24 -04:00
return meta_compositor_drag_window ( window - > display - > compositor ,
window , op ,
2022-10-21 13:52:35 -04:00
device , sequence ,
2022-10-21 06:56:24 -04:00
timestamp ) ;
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
}
2019-11-26 15:01:37 -05:00
MetaStackLayer
meta_window_get_default_layer ( MetaWindow * window )
{
if ( window - > wm_state_below )
return META_LAYER_BOTTOM ;
else if ( window - > wm_state_above & & ! META_WINDOW_MAXIMIZED ( window ) )
return META_LAYER_TOP ;
else
return META_LAYER_NORMAL ;
}
2002-09-24 17:22:06 -04:00
void
meta_window_update_layer ( MetaWindow * window )
{
MetaGroup * group ;
2008-12-18 07:41:56 -05:00
2017-08-26 13:03:51 -04:00
meta_stack_freeze ( window - > display - > stack ) ;
2002-09-24 17:22:06 -04:00
group = meta_window_get_group ( window ) ;
2008-11-03 09:50:22 -05:00
if ( group )
2002-09-24 17:22:06 -04:00
meta_group_update_layers ( group ) ;
else
2017-08-26 13:03:51 -04:00
meta_stack_update_layer ( window - > display - > stack , window ) ;
meta_stack_thaw ( window - > display - > stack ) ;
2002-09-24 17:22:06 -04:00
}
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
2004-08-05 13:48:39 -04:00
/* ensure_mru_position_after ensures that window appears after
* below_this_one in the active_workspace ' s mru_list ( i . e . it treats
* window as having been less recently used than below_this_one )
*/
static void
ensure_mru_position_after ( MetaWindow * window ,
MetaWindow * after_this_one )
{
/* This is sort of slow since it runs through the entire list more
* than once ( especially considering the fact that we expect the
* windows of interest to be the first two elements in the list ) ,
* but it doesn ' t matter while we ' re only using it on new window
* map .
*/
2017-08-27 15:02:40 -04:00
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
2004-08-05 13:48:39 -04:00
GList * active_mru_list ;
GList * window_position ;
GList * after_this_one_position ;
2017-08-27 15:02:40 -04:00
active_mru_list = workspace_manager - > active_workspace - > mru_list ;
2004-08-05 13:48:39 -04:00
window_position = g_list_find ( active_mru_list , window ) ;
after_this_one_position = g_list_find ( active_mru_list , after_this_one ) ;
/* after_this_one_position is NULL when we switch workspaces, but in
* that case we don ' t need to do any MRU shuffling so we can simply
* return .
*/
if ( after_this_one_position = = NULL )
return ;
if ( g_list_length ( window_position ) > g_list_length ( after_this_one_position ) )
{
2017-08-27 15:02:40 -04:00
workspace_manager - > active_workspace - > mru_list =
g_list_delete_link ( workspace_manager - > active_workspace - > mru_list ,
2004-08-05 13:48:39 -04:00
window_position ) ;
2017-08-27 15:02:40 -04:00
workspace_manager - > active_workspace - > mru_list =
g_list_insert_before ( workspace_manager - > active_workspace - > mru_list ,
2004-08-05 13:48:39 -04:00
after_this_one_position - > next ,
window ) ;
}
}
2018-01-09 07:19:40 -05:00
gboolean
meta_window_is_in_stack ( MetaWindow * window )
{
return window - > stack_position > = 0 ;
}
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
void
meta_window_stack_just_below ( MetaWindow * window ,
MetaWindow * below_this_one )
{
g_return_if_fail ( window ! = NULL ) ;
g_return_if_fail ( below_this_one ! = NULL ) ;
if ( window - > stack_position > below_this_one - > stack_position )
{
meta_topic ( META_DEBUG_STACK ,
2020-10-02 11:47:22 -04:00
" Setting stack position of window %s to %d (making it below window %s). " ,
2008-12-18 07:41:56 -05:00
window - > desc ,
below_this_one - > stack_position ,
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
below_this_one - > desc ) ;
2004-08-27 13:22:54 -04:00
meta_window_set_stack_position ( window , below_this_one - > stack_position ) ;
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
}
else
{
meta_topic ( META_DEBUG_STACK ,
2020-10-02 11:47:22 -04:00
" Window %s was already below window %s. " ,
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
window - > desc , below_this_one - > desc ) ;
}
}
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
2017-09-29 10:57:22 -04:00
void
meta_window_stack_just_above ( MetaWindow * window ,
MetaWindow * above_this_one )
{
g_return_if_fail ( window ! = NULL ) ;
g_return_if_fail ( above_this_one ! = NULL ) ;
if ( window - > stack_position < above_this_one - > stack_position )
{
meta_topic ( META_DEBUG_STACK ,
2020-10-02 11:47:22 -04:00
" Setting stack position of window %s to %d (making it above window %s). " ,
2017-09-29 10:57:22 -04:00
window - > desc ,
above_this_one - > stack_position ,
above_this_one - > desc ) ;
meta_window_set_stack_position ( window , above_this_one - > stack_position ) ;
}
else
{
meta_topic ( META_DEBUG_STACK ,
2020-10-02 11:47:22 -04:00
" Window %s was already above window %s. " ,
2017-09-29 10:57:22 -04:00
window - > desc , above_this_one - > desc ) ;
}
}
2009-08-30 20:04:48 -04:00
/**
* meta_window_get_user_time :
2013-02-15 13:42:08 -05:00
* @ window : a # MetaWindow
2009-08-30 20:04:48 -04:00
*
* The user time represents a timestamp for the last time the user
* interacted with this window . Note this property is only available
* for non - override - redirect windows .
*
* The property is set by Mutter initially upon window creation ,
* and updated thereafter on input events ( key and button presses ) seen by Mutter ,
* client updates to the _NET_WM_USER_TIME property ( if later than the current time )
* and when focusing the window .
*
* Returns : The last time the user interacted with this window .
*/
guint32
meta_window_get_user_time ( MetaWindow * window )
{
return window - > net_wm_user_time ;
}
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
void
meta_window_set_user_time ( MetaWindow * window ,
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
guint32 timestamp )
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
{
/* FIXME: If Soeren's suggestion in bug 151984 is implemented, it will allow
* us to sanity check the timestamp here and ensure it doesn ' t correspond to
* a future time .
*/
2009-06-14 08:37:57 -04:00
g_return_if_fail ( ! window - > override_redirect ) ;
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
/* Only update the time if this timestamp is newer... */
if ( window - > net_wm_user_time_set & &
XSERVER_TIME_IS_BEFORE ( timestamp , window - > net_wm_user_time ) )
{
meta_topic ( META_DEBUG_STARTUP ,
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
" Window %s _NET_WM_USER_TIME not updated to %u, because it "
2020-10-02 11:47:22 -04:00
" is less than %u " ,
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
window - > desc , timestamp , window - > net_wm_user_time ) ;
}
else
{
meta_topic ( META_DEBUG_STARTUP ,
2020-10-02 11:47:22 -04:00
" Window %s has _NET_WM_USER_TIME of %u " ,
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
window - > desc , timestamp ) ;
window - > net_wm_user_time_set = TRUE ;
window - > net_wm_user_time = timestamp ;
if ( XSERVER_TIME_IS_BEFORE ( window - > display - > last_user_time , timestamp ) )
window - > display - > last_user_time = timestamp ;
2006-01-15 12:03:57 -05:00
/* If this is a terminal, user interaction with it means the user likely
* doesn ' t want to have focus transferred for now due to new windows .
*/
2014-03-18 10:08:28 -04:00
if ( meta_prefs_get_focus_new_windows ( ) = = G_DESKTOP_FOCUS_NEW_WINDOWS_STRICT & &
window_is_terminal ( window ) )
2006-01-15 12:03:57 -05:00
window - > display - > allow_terminal_deactivation = FALSE ;
2009-08-31 12:06:53 -04:00
2019-07-19 11:47:43 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_USER_TIME ] ) ;
}
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
}
2006-03-29 13:43:22 -05:00
2009-09-18 20:50:11 -04:00
/**
* meta_window_get_stable_sequence :
* @ window : A # MetaWindow
*
* The stable sequence number is a monotonicially increasing
* unique integer assigned to each # MetaWindow upon creation .
*
* This number can be useful for sorting windows in a stable
* fashion .
*
* Returns : Internal sequence number for this window
*/
guint32
meta_window_get_stable_sequence ( MetaWindow * window )
{
g_return_val_if_fail ( META_IS_WINDOW ( window ) , 0 ) ;
return window - > stable_sequence ;
}
2006-03-29 13:43:22 -05:00
/* Sets the demands_attention hint on a window, but only
* if it ' s at least partially obscured ( see # 305882 ) .
*/
void
meta_window_set_demands_attention ( MetaWindow * window )
{
2017-08-27 15:02:40 -04:00
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
2006-03-29 13:43:22 -05:00
MetaRectangle candidate_rect , other_rect ;
2017-08-26 13:03:51 -04:00
GList * stack = window - > display - > stack - > sorted ;
2006-03-29 13:43:22 -05:00
MetaWindow * other_window ;
gboolean obscured = FALSE ;
2008-12-18 07:41:56 -05:00
2017-08-27 15:02:40 -04:00
MetaWorkspace * workspace = workspace_manager - > active_workspace ;
2009-11-17 05:02:06 -05:00
if ( window - > wm_state_demands_attention )
return ;
2014-08-16 13:22:05 -04:00
if ( ! meta_window_located_on_workspace ( window , workspace ) )
2006-03-29 13:43:22 -05:00
{
2008-02-01 23:05:16 -05:00
/* windows on other workspaces are necessarily obscured */
obscured = TRUE ;
}
2008-10-21 23:21:23 -04:00
else if ( window - > minimized )
{
obscured = TRUE ;
}
2008-02-01 23:05:16 -05:00
else
{
2013-11-19 12:24:45 -05:00
meta_window_get_frame_rect ( window , & candidate_rect ) ;
2006-03-29 13:43:22 -05:00
2008-02-01 23:05:16 -05:00
/* The stack is sorted with the top windows first. */
2008-12-18 07:41:56 -05:00
2008-02-01 23:05:16 -05:00
while ( stack ! = NULL & & stack - > data ! = window )
{
other_window = stack - > data ;
stack = stack - > next ;
2008-12-18 07:41:56 -05:00
2014-09-26 22:12:52 -04:00
if ( meta_window_located_on_workspace ( other_window , workspace ) )
2006-03-29 13:43:22 -05:00
{
2013-11-19 12:24:45 -05:00
meta_window_get_frame_rect ( other_window , & other_rect ) ;
2008-02-01 23:05:16 -05:00
if ( meta_rectangle_overlap ( & candidate_rect , & other_rect ) )
{
obscured = TRUE ;
break ;
}
2006-03-29 13:43:22 -05:00
}
}
2008-10-21 23:21:23 -04:00
}
if ( obscured )
{
2006-03-29 13:43:22 -05:00
meta_topic ( META_DEBUG_WINDOW_OPS ,
2020-10-02 11:47:22 -04:00
" Marking %s as needing attention " ,
2008-10-21 23:21:23 -04:00
window - > desc ) ;
window - > wm_state_demands_attention = TRUE ;
set_net_wm_state ( window ) ;
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_DEMANDS_ATTENTION ] ) ;
2009-10-28 13:19:24 -04:00
g_signal_emit_by_name ( window - > display , " window-demands-attention " ,
window ) ;
2006-03-29 13:43:22 -05:00
}
2008-10-21 23:21:23 -04:00
else
{
/* If the window's in full view, there's no point setting the flag. */
2006-03-29 13:43:22 -05:00
2008-10-21 23:21:23 -04:00
meta_topic ( META_DEBUG_WINDOW_OPS ,
" Not marking %s as needing attention because "
2020-10-02 11:47:22 -04:00
" it's in full view " ,
2008-10-21 23:21:23 -04:00
window - > desc ) ;
}
2006-03-29 13:43:22 -05:00
}
void
meta_window_unset_demands_attention ( MetaWindow * window )
{
meta_topic ( META_DEBUG_WINDOW_OPS ,
2020-10-02 11:47:22 -04:00
" Marking %s as not needing attention " , window - > desc ) ;
2008-12-18 07:41:56 -05:00
2009-11-17 05:02:06 -05:00
if ( window - > wm_state_demands_attention )
{
window - > wm_state_demands_attention = FALSE ;
set_net_wm_state ( window ) ;
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_DEMANDS_ATTENTION ] ) ;
2009-11-17 05:02:06 -05:00
}
2006-03-29 13:43:22 -05:00
}
2008-05-18 20:00:09 -04:00
2010-09-01 15:39:53 -04:00
/**
* meta_window_get_frame : ( skip )
2013-02-15 13:42:08 -05:00
* @ window : a # MetaWindow
2010-09-01 15:39:53 -04:00
*
*/
2008-05-18 20:00:09 -04:00
MetaFrame *
meta_window_get_frame ( MetaWindow * window )
{
return window - > frame ;
}
2010-11-11 16:04:31 -05:00
/**
* meta_window_appears_focused :
* @ window : a # MetaWindow
*
* Determines if the window should be drawn with a focused appearance . This is
* true for focused windows but also true for windows with a focused modal
* dialog attached .
*
* Return value : % TRUE if the window should be drawn with a focused frame
*/
2010-09-10 05:55:20 -04:00
gboolean
meta_window_appears_focused ( MetaWindow * window )
{
2019-10-12 14:55:26 -04:00
return window - > appears_focused ;
2010-09-10 05:55:20 -04:00
}
2008-05-18 20:00:09 -04:00
gboolean
meta_window_has_focus ( MetaWindow * window )
{
return window - > has_focus ;
}
gboolean
meta_window_is_shaded ( MetaWindow * window )
{
return window - > shaded ;
}
2009-08-14 05:42:56 -04:00
/**
* meta_window_is_override_redirect :
* @ window : A # MetaWindow
*
2013-02-15 13:42:08 -05:00
* Returns : % TRUE if this window isn ' t managed by mutter ; it will
2009-08-14 05:42:56 -04:00
* control its own positioning and mutter won ' t draw decorations
* among other things . In X terminology this is " override redirect " .
*/
gboolean
meta_window_is_override_redirect ( MetaWindow * window )
{
return window - > override_redirect ;
}
2009-08-28 12:39:55 -04:00
/**
* meta_window_is_skip_taskbar :
* @ window : A # MetaWindow
*
* Gets whether this window should be ignored by task lists .
*
* Return value : % TRUE if the skip bar hint is set .
*/
gboolean
meta_window_is_skip_taskbar ( MetaWindow * window )
{
g_return_val_if_fail ( META_IS_WINDOW ( window ) , FALSE ) ;
return window - > skip_taskbar ;
}
2010-09-01 15:39:53 -04:00
/**
* meta_window_get_display :
* @ window : A # MetaWindow
*
* Returns : ( transfer none ) : The display for @ window
*/
2008-05-18 20:00:09 -04:00
MetaDisplay *
meta_window_get_display ( MetaWindow * window )
{
return window - > display ;
}
2010-09-01 15:39:53 -04:00
/**
* meta_window_get_xwindow : ( skip )
2013-02-15 13:42:08 -05:00
* @ window : a # MetaWindow
2010-09-01 15:39:53 -04:00
*
*/
2008-05-18 20:00:09 -04:00
Window
meta_window_get_xwindow ( MetaWindow * window )
{
return window - > xwindow ;
}
2008-08-18 10:42:38 -04:00
MetaWindowType
2008-11-07 04:57:00 -05:00
meta_window_get_window_type ( MetaWindow * window )
2008-08-18 10:42:38 -04:00
{
return window - > type ;
}
2008-11-17 16:34:28 -05:00
/**
* meta_window_get_workspace :
* @ window : a # MetaWindow
*
* Gets the # MetaWorkspace that the window is currently displayed on .
* If the window is on all workspaces , returns the currently active
* workspace .
*
* Return value : ( transfer none ) : the # MetaWorkspace for the window
*/
2008-09-18 11:09:11 -04:00
MetaWorkspace *
meta_window_get_workspace ( MetaWindow * window )
{
2017-08-27 15:02:40 -04:00
MetaWorkspaceManager * workspace_manager = window - > display - > workspace_manager ;
2008-09-18 11:09:11 -04:00
if ( window - > on_all_workspaces )
2017-08-27 15:02:40 -04:00
return workspace_manager - > active_workspace ;
2014-08-16 13:22:05 -04:00
else
return window - > workspace ;
2008-09-18 11:09:11 -04:00
}
gboolean
meta_window_is_on_all_workspaces ( MetaWindow * window )
{
return window - > on_all_workspaces ;
}
2008-10-24 05:07:24 -04:00
gboolean
meta_window_is_hidden ( MetaWindow * window )
{
return window - > hidden ;
}
2008-10-30 04:30:42 -04:00
const char *
meta_window_get_description ( MetaWindow * window )
{
if ( ! window )
return NULL ;
return window - > desc ;
}
2008-11-23 14:28:40 -05:00
2009-05-29 13:26:18 -04:00
/**
* meta_window_get_wm_class :
* @ window : a # MetaWindow
2010-03-17 05:20:39 -04:00
*
* Return the current value of the name part of WM_CLASS X property .
2022-04-05 06:45:22 -04:00
*
* Returns : ( nullable ) : the current value of the name part of WM_CLASS X
* property
2009-05-29 13:26:18 -04:00
*/
const char *
meta_window_get_wm_class ( MetaWindow * window )
{
if ( ! window )
return NULL ;
return window - > res_class ;
}
2010-03-17 05:20:39 -04:00
/**
* meta_window_get_wm_class_instance :
* @ window : a # MetaWindow
*
* Return the current value of the instance part of WM_CLASS X property .
2022-04-05 06:45:22 -04:00
*
* Returns : ( nullable ) : the current value of the instance part of WM_CLASS X
* property .
2010-03-17 05:20:39 -04:00
*/
const char *
meta_window_get_wm_class_instance ( MetaWindow * window )
{
if ( ! window )
return NULL ;
return window - > res_name ;
}
2016-10-07 11:55:32 -04:00
/**
2017-10-20 22:45:23 -04:00
* meta_window_get_sandboxed_app_id :
2016-10-07 11:55:32 -04:00
* @ window : a # MetaWindow
*
2017-10-20 22:45:23 -04:00
* Gets an unique id for a sandboxed app ( currently flatpaks and snaps are
* supported ) .
*
2022-04-05 06:45:22 -04:00
* Returns : ( transfer none ) ( nullable ) : the sandboxed application ID or % NULL
2016-10-07 11:55:32 -04:00
* */
const char *
2017-10-20 22:45:23 -04:00
meta_window_get_sandboxed_app_id ( MetaWindow * window )
2016-10-07 11:55:32 -04:00
{
2017-09-26 17:22:43 -04:00
/* We're abusing this API here not to break the gnome shell assumptions
* or adding a new function , to be renamed to generic names in new versions */
return window - > sandboxed_app_id ;
2016-10-07 11:55:32 -04:00
}
2014-05-25 10:57:15 -04:00
/**
* meta_window_get_gtk_theme_variant :
* @ window : a # MetaWindow
*
2022-04-05 06:45:22 -04:00
* Returns : ( transfer none ) ( nullable ) : the theme variant or % NULL
2014-05-25 10:57:15 -04:00
* */
const char *
meta_window_get_gtk_theme_variant ( MetaWindow * window )
{
return window - > gtk_theme_variant ;
}
2011-11-25 18:42:41 -05:00
/**
2012-01-17 13:27:10 -05:00
* meta_window_get_gtk_application_id :
2011-11-25 18:42:41 -05:00
* @ window : a # MetaWindow
*
2022-04-05 06:45:22 -04:00
* Returns : ( transfer none ) ( nullable ) : the application ID
2011-11-25 18:42:41 -05:00
* */
const char *
2012-01-17 13:27:10 -05:00
meta_window_get_gtk_application_id ( MetaWindow * window )
2011-11-25 18:42:41 -05:00
{
2012-01-17 13:27:10 -05:00
return window - > gtk_application_id ;
2011-11-25 18:42:41 -05:00
}
2011-12-05 12:52:35 -05:00
/**
2012-01-17 13:27:10 -05:00
* meta_window_get_gtk_unique_bus_name :
2011-12-05 12:52:35 -05:00
* @ window : a # MetaWindow
*
2022-04-05 06:45:22 -04:00
* Returns : ( transfer none ) ( nullable ) : the unique name
2011-12-05 12:52:35 -05:00
* */
const char *
2012-01-17 13:27:10 -05:00
meta_window_get_gtk_unique_bus_name ( MetaWindow * window )
{
return window - > gtk_unique_bus_name ;
}
/**
* meta_window_get_gtk_application_object_path :
* @ window : a # MetaWindow
*
2022-04-05 06:45:22 -04:00
* Returns : ( transfer none ) ( nullable ) : the object path
2012-01-17 13:27:10 -05:00
* */
const char *
meta_window_get_gtk_application_object_path ( MetaWindow * window )
{
return window - > gtk_application_object_path ;
}
/**
* meta_window_get_gtk_window_object_path :
* @ window : a # MetaWindow
*
2022-04-05 06:45:22 -04:00
* Returns : ( transfer none ) ( nullable ) : the object path
2012-01-17 13:27:10 -05:00
* */
const char *
meta_window_get_gtk_window_object_path ( MetaWindow * window )
{
return window - > gtk_window_object_path ;
}
/**
* meta_window_get_gtk_app_menu_object_path :
* @ window : a # MetaWindow
*
2022-04-05 06:45:22 -04:00
* Returns : ( transfer none ) ( nullable ) : the object path
2012-01-17 13:27:10 -05:00
* */
const char *
meta_window_get_gtk_app_menu_object_path ( MetaWindow * window )
2011-12-05 12:52:35 -05:00
{
2012-01-17 13:27:10 -05:00
return window - > gtk_app_menu_object_path ;
2011-12-05 12:52:35 -05:00
}
/**
2012-01-17 13:27:10 -05:00
* meta_window_get_gtk_menubar_object_path :
2011-12-05 12:52:35 -05:00
* @ window : a # MetaWindow
*
2022-04-05 06:45:22 -04:00
* Returns : ( transfer none ) ( nullable ) : the object path
2011-12-05 12:52:35 -05:00
* */
const char *
2012-01-17 13:27:10 -05:00
meta_window_get_gtk_menubar_object_path ( MetaWindow * window )
2011-12-05 12:52:35 -05:00
{
2012-01-17 13:27:10 -05:00
return window - > gtk_menubar_object_path ;
2011-12-05 12:52:35 -05:00
}
2009-02-02 15:16:05 -05:00
/**
* meta_window_get_compositor_private :
* @ window : a # MetaWindow
*
* Gets the compositor ' s wrapper object for @ window .
*
* Return value : ( transfer none ) : the wrapper object .
* */
GObject *
2008-11-23 14:28:40 -05:00
meta_window_get_compositor_private ( MetaWindow * window )
{
if ( ! window )
return NULL ;
return window - > compositor_private ;
}
void
2009-02-02 15:16:05 -05:00
meta_window_set_compositor_private ( MetaWindow * window , GObject * priv )
2008-11-23 14:28:40 -05:00
{
if ( ! window )
return ;
window - > compositor_private = priv ;
}
2009-01-12 07:30:31 -05:00
const char *
meta_window_get_role ( MetaWindow * window )
{
if ( ! window )
return NULL ;
return window - > role ;
}
2009-06-09 23:02:14 -04:00
/**
* meta_window_get_title :
* @ window : a # MetaWindow
*
2013-02-15 13:42:08 -05:00
* Returns : the current title of the window .
2009-06-09 23:02:14 -04:00
*/
const char *
meta_window_get_title ( MetaWindow * window )
{
g_return_val_if_fail ( META_IS_WINDOW ( window ) , NULL ) ;
return window - > title ;
}
2009-03-12 17:07:27 -04:00
MetaStackLayer
meta_window_get_layer ( MetaWindow * window )
{
return window - > layer ;
}
2009-06-09 23:28:21 -04:00
/**
* meta_window_get_transient_for :
* @ window : a # MetaWindow
*
* Returns the # MetaWindow for the window that is pointed to by the
* WM_TRANSIENT_FOR hint on this window ( see XGetTransientForHint ( )
2022-04-05 06:45:22 -04:00
* or XSetTransientForHint ( ) ) . Mutter keeps transient windows above their
2009-06-09 23:28:21 -04:00
* parents . A typical usage of this hint is for a dialog that wants to stay
* above its associated window .
*
2022-04-05 06:45:22 -04:00
* Returns : ( transfer none ) ( nullable ) : the window this window is transient for ,
* or % NULL if the WM_TRANSIENT_FOR hint is unset or does not point to a
* toplevel window that Mutter knows about .
2009-06-09 23:28:21 -04:00
*/
MetaWindow *
meta_window_get_transient_for ( MetaWindow * window )
{
g_return_val_if_fail ( META_IS_WINDOW ( window ) , NULL ) ;
2013-09-16 08:44:37 -04:00
if ( window - > transient_for )
return window - > transient_for ;
else if ( window - > xtransient_for )
2017-08-26 12:56:44 -04:00
return meta_x11_display_lookup_x_window ( window - > display - > x11_display ,
window - > xtransient_for ) ;
2009-06-09 23:28:21 -04:00
else
return NULL ;
}
2009-07-31 13:52:25 -04:00
2016-10-07 11:55:32 -04:00
/**
2020-04-06 07:03:49 -04:00
* meta_window_get_pid :
2016-10-07 11:55:32 -04:00
* @ window : a # MetaWindow
*
* Returns the pid of the process that created this window , if available
* to the windowing system .
*
2020-04-06 14:14:12 -04:00
* Note that the value returned by this is vulnerable to spoofing attacks
* by the client .
*
2016-10-07 11:55:32 -04:00
* Return value : the pid , or 0 if not known .
*/
2020-04-08 10:17:09 -04:00
pid_t
2009-07-31 13:52:25 -04:00
meta_window_get_pid ( MetaWindow * window )
{
2020-04-06 07:03:49 -04:00
g_return_val_if_fail ( META_IS_WINDOW ( window ) , 0 ) ;
2009-07-31 13:52:25 -04:00
2020-04-06 14:08:12 -04:00
if ( window - > client_pid = = 0 )
window - > client_pid = META_WINDOW_GET_CLASS ( window ) - > get_client_pid ( window ) ;
return window - > client_pid ;
2009-07-31 13:52:25 -04:00
}
2021-08-05 10:35:18 -04:00
/**
* meta_window_get_unit_cgroup :
* @ window : a # MetaWindow
*
2022-04-05 06:45:22 -04:00
* Returns : ( nullable ) : a # GFile for the cgroup path , or % NULL .
2021-08-05 10:35:18 -04:00
*/
GFile *
meta_window_get_unit_cgroup ( MetaWindow * window )
{
# ifdef HAVE_LIBSYSTEMD
g_autofree char * contents = NULL ;
g_autofree char * complete_path = NULL ;
g_autofree char * unit_name = NULL ;
g_autofree char * unit_path = NULL ;
char * unit_end ;
pid_t pid ;
if ( ! window - > has_valid_cgroup )
return NULL ;
if ( window - > cgroup_path )
return window - > cgroup_path ;
pid = meta_window_get_pid ( window ) ;
if ( pid < 1 )
return NULL ;
if ( sd_pid_get_cgroup ( pid , & contents ) < 0 )
{
window - > has_valid_cgroup = FALSE ;
return NULL ;
}
g_strstrip ( contents ) ;
complete_path = g_strdup_printf ( " %s%s " , " /sys/fs/cgroup " , contents ) ;
if ( sd_pid_get_user_unit ( pid , & unit_name ) < 0 )
{
window - > has_valid_cgroup = FALSE ;
return NULL ;
}
g_strstrip ( unit_name ) ;
unit_end = strstr ( complete_path , unit_name ) + strlen ( unit_name ) ;
* unit_end = ' \0 ' ;
window - > cgroup_path = g_file_new_for_path ( complete_path ) ;
return window - > cgroup_path ;
# else
return NULL ;
# endif
}
gboolean
meta_window_unit_cgroup_equal ( MetaWindow * window1 ,
MetaWindow * window2 )
{
GFile * window1_file , * window2_file ;
window1_file = meta_window_get_unit_cgroup ( window1 ) ;
window2_file = meta_window_get_unit_cgroup ( window2 ) ;
if ( ! window1_file | | ! window2_file )
return FALSE ;
return g_file_equal ( window1_file , window2_file ) ;
}
2009-07-31 13:52:25 -04:00
/**
* meta_window_get_client_machine :
* @ window : a # MetaWindow
*
* Returns name of the client machine from which this windows was created ,
* if known ( obtained from the WM_CLIENT_MACHINE property ) .
*
2022-04-05 06:45:22 -04:00
* Returns : ( transfer none ) ( nullable ) : the machine name , or % NULL ; the string
* is owned by the window manager and should not be freed or modified by the
2009-07-31 13:52:25 -04:00
* caller .
*/
const char *
meta_window_get_client_machine ( MetaWindow * window )
{
g_return_val_if_fail ( META_IS_WINDOW ( window ) , NULL ) ;
return window - > wm_client_machine ;
}
2010-06-04 13:57:41 -04:00
/**
* meta_window_is_remote :
* @ window : a # MetaWindow
*
* Returns : % TRUE if this window originates from a host
* different from the one running mutter .
*/
gboolean
meta_window_is_remote ( MetaWindow * window )
{
2013-02-20 15:17:21 -05:00
return window - > is_remote ;
2010-06-04 13:57:41 -04:00
}
2010-01-18 05:12:17 -05:00
/**
* meta_window_get_mutter_hints :
* @ window : a # MetaWindow
*
* Gets the current value of the _MUTTER_HINTS property .
*
* The purpose of the hints is to allow fine - tuning of the Window Manager and
* Compositor behaviour on per - window basis , and is intended primarily for
* hints that are plugin - specific .
*
* The property is a list of colon - separated key = value pairs . The key names for
* any plugin - specific hints must be suitably namespaced to allow for shared
* use ; ' mutter - ' key prefix is reserved for internal use , and must not be used
* by plugins .
*
2022-04-05 06:45:22 -04:00
* Returns : ( transfer none ) ( nullable ) : the _MUTTER_HINTS string , or % NULL if no
* hints are set .
2010-01-18 05:12:17 -05:00
*/
const char *
meta_window_get_mutter_hints ( MetaWindow * window )
{
g_return_val_if_fail ( META_IS_WINDOW ( window ) , NULL ) ;
return window - > mutter_hints ;
}
2010-11-11 16:12:11 -05:00
/**
* meta_window_get_frame_type :
* @ window : a # MetaWindow
*
* Gets the type of window decorations that should be used for this window .
*
* Return value : the frame type
*/
MetaFrameType
meta_window_get_frame_type ( MetaWindow * window )
{
MetaFrameType base_type = META_FRAME_TYPE_LAST ;
switch ( window - > type )
{
case META_WINDOW_NORMAL :
base_type = META_FRAME_TYPE_NORMAL ;
break ;
case META_WINDOW_DIALOG :
base_type = META_FRAME_TYPE_DIALOG ;
break ;
case META_WINDOW_MODAL_DIALOG :
window: make determination of attached dialog windows more consistent
Different bits of code were using slightly different checks to test
whether a window was an attached dialog. Add a new
meta_window_is_attached_dialog(), and use that everywhere.
Also, freeze the is-attached status when the window is first shown,
rather than recomputing it each time the caller asks, since this could
cause problems if a window changes its type after it has already been
attached, etc. However, if an attached window's parent is destroyed,
or an attached window changes its transient-for, then fix things up by
destroying the old MetaWindow and creating a new one (causing
compositor unmap and map events to be fired off, allowing the display
of the window to be fixed up).
Remove some code in display.c that tried to fix existing windows if
the gconf setting changed, but which didn't actually do anything (at
least under gnome-shell). However, if 654643 was fixed then the new
behavior with this patch would be that changing the gconf setting
would affect new dialogs, but not existing ones.
https://bugzilla.gnome.org/show_bug.cgi?id=646761
2011-04-05 10:14:52 -04:00
if ( meta_window_is_attached_dialog ( window ) )
2010-11-11 16:12:11 -05:00
base_type = META_FRAME_TYPE_ATTACHED ;
else
base_type = META_FRAME_TYPE_MODAL_DIALOG ;
break ;
case META_WINDOW_MENU :
base_type = META_FRAME_TYPE_MENU ;
break ;
case META_WINDOW_UTILITY :
base_type = META_FRAME_TYPE_UTILITY ;
break ;
case META_WINDOW_DESKTOP :
case META_WINDOW_DOCK :
case META_WINDOW_TOOLBAR :
case META_WINDOW_SPLASHSCREEN :
case META_WINDOW_DROPDOWN_MENU :
case META_WINDOW_POPUP_MENU :
case META_WINDOW_TOOLTIP :
case META_WINDOW_NOTIFICATION :
case META_WINDOW_COMBO :
case META_WINDOW_DND :
case META_WINDOW_OVERRIDE_OTHER :
/* No frame */
base_type = META_FRAME_TYPE_LAST ;
break ;
}
if ( base_type = = META_FRAME_TYPE_LAST )
{
/* can't add border if undecorated */
return META_FRAME_TYPE_LAST ;
}
2018-09-08 07:26:13 -04:00
else if ( window - > border_only )
2010-11-11 16:12:11 -05:00
{
/* override base frame type */
return META_FRAME_TYPE_BORDER ;
}
else
{
return base_type ;
}
}
2011-03-22 15:36:12 -04:00
/**
* meta_window_get_frame_bounds :
2013-02-15 13:42:08 -05:00
* @ window : a # MetaWindow
2011-03-22 15:36:12 -04:00
*
* Gets a region representing the outer bounds of the window ' s frame .
*
2014-05-28 15:44:23 -04:00
* Return value : ( transfer none ) ( nullable ) : a # cairo_region_t
2011-03-22 15:36:12 -04:00
* holding the outer bounds of the window , or % NULL if the window
* doesn ' t have a frame .
*/
cairo_region_t *
meta_window_get_frame_bounds ( MetaWindow * window )
{
if ( ! window - > frame_bounds )
{
if ( window - > frame )
window - > frame_bounds = meta_frame_get_frame_bounds ( window - > frame ) ;
}
return window - > frame_bounds ;
}
window: make determination of attached dialog windows more consistent
Different bits of code were using slightly different checks to test
whether a window was an attached dialog. Add a new
meta_window_is_attached_dialog(), and use that everywhere.
Also, freeze the is-attached status when the window is first shown,
rather than recomputing it each time the caller asks, since this could
cause problems if a window changes its type after it has already been
attached, etc. However, if an attached window's parent is destroyed,
or an attached window changes its transient-for, then fix things up by
destroying the old MetaWindow and creating a new one (causing
compositor unmap and map events to be fired off, allowing the display
of the window to be fixed up).
Remove some code in display.c that tried to fix existing windows if
the gconf setting changed, but which didn't actually do anything (at
least under gnome-shell). However, if 654643 was fixed then the new
behavior with this patch would be that changing the gconf setting
would affect new dialogs, but not existing ones.
https://bugzilla.gnome.org/show_bug.cgi?id=646761
2011-04-05 10:14:52 -04:00
/**
* meta_window_is_attached_dialog :
* @ window : a # MetaWindow
*
2021-11-30 10:37:01 -05:00
* Tests if @ window should be attached to its parent window .
window: make determination of attached dialog windows more consistent
Different bits of code were using slightly different checks to test
whether a window was an attached dialog. Add a new
meta_window_is_attached_dialog(), and use that everywhere.
Also, freeze the is-attached status when the window is first shown,
rather than recomputing it each time the caller asks, since this could
cause problems if a window changes its type after it has already been
attached, etc. However, if an attached window's parent is destroyed,
or an attached window changes its transient-for, then fix things up by
destroying the old MetaWindow and creating a new one (causing
compositor unmap and map events to be fired off, allowing the display
of the window to be fixed up).
Remove some code in display.c that tried to fix existing windows if
the gconf setting changed, but which didn't actually do anything (at
least under gnome-shell). However, if 654643 was fixed then the new
behavior with this patch would be that changing the gconf setting
would affect new dialogs, but not existing ones.
https://bugzilla.gnome.org/show_bug.cgi?id=646761
2011-04-05 10:14:52 -04:00
* ( If the " attach_modal_dialogs " option is not enabled , this will
* always return % FALSE . )
*
* Return value : whether @ window should be attached to its parent
*/
gboolean
meta_window_is_attached_dialog ( MetaWindow * window )
{
return window - > attached ;
}
2012-02-24 11:08:55 -05:00
2021-11-30 10:49:20 -05:00
static gboolean
has_attached_foreach_func ( MetaWindow * window ,
void * data )
{
gboolean * is_attached = data ;
* is_attached = window - > attached & & ! window - > unmanaging ;
if ( * is_attached )
return FALSE ;
return TRUE ;
}
/**
* meta_window_has_attached_dialogs :
* @ window : a # MetaWindow
*
* Tests if @ window has any transients attached to it .
* ( If the " attach_modal_dialogs " option is not enabled , this will
* always return % FALSE . )
*
* Return value : whether @ window has attached transients
*/
gboolean
meta_window_has_attached_dialogs ( MetaWindow * window )
{
gboolean has_attached = FALSE ;
meta_window_foreach_transient ( window ,
has_attached_foreach_func ,
& has_attached ) ;
return has_attached ;
}
2021-12-10 21:04:24 -05:00
static gboolean
has_modals_foreach_func ( MetaWindow * window ,
void * data )
{
gboolean * is_modal = data ;
* is_modal = window - > type = = META_WINDOW_MODAL_DIALOG & & ! window - > unmanaging ;
if ( * is_modal )
return FALSE ;
return TRUE ;
}
/**
* meta_window_has_modals :
* @ window : a # MetaWindow
*
* Return value : whether @ window has any modal transients
*/
gboolean
meta_window_has_modals ( MetaWindow * window )
{
gboolean has_modals = FALSE ;
meta_window_foreach_transient ( window , has_modals_foreach_func , & has_modals ) ;
return has_modals ;
}
2016-01-10 09:16:09 -05:00
/**
* meta_window_get_tile_match :
* @ window : a # MetaWindow
*
* Returns the matching tiled window on the same monitor as @ window . This is
* the topmost tiled window in a complementary tile mode that is :
*
* - on the same monitor ;
* - on the same workspace ;
* - spanning the remaining monitor width ;
* - there is no 3 rd window stacked between both tiled windows that ' s
* partially visible in the common edge .
*
* Return value : ( transfer none ) ( nullable ) : the matching tiled window or
* % NULL if it doesn ' t exist .
*/
MetaWindow *
meta_window_get_tile_match ( MetaWindow * window )
{
return window - > tile_match ;
}
void
meta_window_compute_tile_match ( MetaWindow * window )
2017-06-11 21:13:03 -04:00
{
window - > tile_match = meta_window_find_tile_match ( window , window - > tile_mode ) ;
}
static MetaWindow *
meta_window_find_tile_match ( MetaWindow * window ,
MetaTileMode current_mode )
2016-01-10 09:16:09 -05:00
{
MetaWindow * match ;
MetaStack * stack ;
MetaTileMode match_tile_mode = META_TILE_NONE ;
if ( window - > shaded | | window - > minimized )
2017-06-11 21:13:03 -04:00
return NULL ;
2016-01-10 09:16:09 -05:00
2017-06-11 21:13:03 -04:00
if ( current_mode = = META_TILE_LEFT )
2016-01-10 09:16:09 -05:00
match_tile_mode = META_TILE_RIGHT ;
2017-06-11 21:13:03 -04:00
else if ( current_mode = = META_TILE_RIGHT )
2016-01-10 09:16:09 -05:00
match_tile_mode = META_TILE_LEFT ;
else
2017-06-11 21:13:03 -04:00
return NULL ;
2016-01-10 09:16:09 -05:00
2017-08-26 13:03:51 -04:00
stack = window - > display - > stack ;
2016-01-10 09:16:09 -05:00
for ( match = meta_stack_get_top ( stack ) ;
match ;
match = meta_stack_get_below ( stack , match , FALSE ) )
{
if ( ! match - > shaded & &
! match - > minimized & &
match - > tile_mode = = match_tile_mode & &
2017-06-11 21:13:03 -04:00
match - > tile_monitor_number = = window - > tile_monitor_number & &
2016-01-10 09:16:09 -05:00
meta_window_get_workspace ( match ) = = meta_window_get_workspace ( window ) )
break ;
}
if ( match )
{
MetaWindow * above , * bottommost , * topmost ;
MetaRectangle above_rect , bottommost_rect , topmost_rect ;
2022-10-21 06:56:24 -04:00
MetaWindowDrag * window_drag ;
2016-01-10 09:16:09 -05:00
2017-08-26 13:03:51 -04:00
if ( meta_stack_windows_cmp ( window - > display - > stack , match , window ) > 0 )
2016-01-10 09:16:09 -05:00
{
topmost = match ;
bottommost = window ;
}
else
{
topmost = window ;
bottommost = match ;
}
meta_window_get_frame_rect ( bottommost , & bottommost_rect ) ;
meta_window_get_frame_rect ( topmost , & topmost_rect ) ;
2017-06-15 20:29:48 -04:00
2022-10-21 06:56:24 -04:00
window_drag =
meta_compositor_get_current_window_drag ( window - > display - > compositor ) ;
2017-06-15 20:29:48 -04:00
/*
* If we are looking for a tile match while actually being tiled ,
* rather than a match for a potential tile mode , then discard
* windows with too much gap or overlap
*/
if ( window - > tile_mode = = current_mode & &
2022-10-21 06:56:24 -04:00
! ( window_drag & &
meta_grab_op_is_resizing ( meta_window_drag_get_grab_op ( window_drag ) ) & &
meta_window_drag_get_window ( window_drag ) = = window & &
2017-06-15 20:29:48 -04:00
window - > tile_match ! = NULL ) )
{
int threshold = meta_prefs_get_drag_threshold ( ) ;
if ( ABS ( topmost_rect . x - bottommost_rect . x - bottommost_rect . width ) > threshold & &
ABS ( bottommost_rect . x - topmost_rect . x - topmost_rect . width ) > threshold )
return NULL ;
}
2016-01-10 09:16:09 -05:00
/*
* If there ' s a window stacked in between which is partially visible
* behind the topmost tile we don ' t consider the tiles to match .
*/
for ( above = meta_stack_get_above ( stack , bottommost , FALSE ) ;
above & & above ! = topmost ;
above = meta_stack_get_above ( stack , above , FALSE ) )
{
if ( above - > minimized | |
above - > monitor ! = window - > monitor | |
meta_window_get_workspace ( above ) ! = meta_window_get_workspace ( window ) )
continue ;
meta_window_get_frame_rect ( above , & above_rect ) ;
if ( meta_rectangle_overlap ( & above_rect , & bottommost_rect ) & &
meta_rectangle_overlap ( & above_rect , & topmost_rect ) )
2017-06-11 21:13:03 -04:00
return NULL ;
2016-01-10 09:16:09 -05:00
}
}
2017-06-11 21:13:03 -04:00
return match ;
2016-01-10 09:16:09 -05:00
}
2013-08-30 03:40:36 -04:00
void
meta_window_set_title ( MetaWindow * window ,
const char * title )
{
g_free ( window - > title ) ;
window - > title = g_strdup ( title ) ;
2014-03-18 21:19:51 -04:00
meta_window_update_desc ( window ) ;
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_TITLE ] ) ;
2013-08-30 03:40:36 -04:00
}
void
meta_window_set_wm_class ( MetaWindow * window ,
const char * wm_class ,
const char * wm_instance )
{
g_free ( window - > res_class ) ;
g_free ( window - > res_name ) ;
window - > res_name = g_strdup ( wm_instance ) ;
window - > res_class = g_strdup ( wm_class ) ;
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_WM_CLASS ] ) ;
2013-08-30 03:40:36 -04:00
}
void
meta_window_set_gtk_dbus_properties ( MetaWindow * window ,
const char * application_id ,
const char * unique_bus_name ,
const char * appmenu_path ,
const char * menubar_path ,
const char * application_object_path ,
const char * window_object_path )
{
g_object_freeze_notify ( G_OBJECT ( window ) ) ;
g_free ( window - > gtk_application_id ) ;
window - > gtk_application_id = g_strdup ( application_id ) ;
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_GTK_APPLICATION_ID ] ) ;
2013-08-30 03:40:36 -04:00
g_free ( window - > gtk_unique_bus_name ) ;
window - > gtk_unique_bus_name = g_strdup ( unique_bus_name ) ;
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_GTK_UNIQUE_BUS_NAME ] ) ;
2013-08-30 03:40:36 -04:00
g_free ( window - > gtk_app_menu_object_path ) ;
window - > gtk_app_menu_object_path = g_strdup ( appmenu_path ) ;
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_GTK_APP_MENU_OBJECT_PATH ] ) ;
2013-08-30 03:40:36 -04:00
g_free ( window - > gtk_menubar_object_path ) ;
window - > gtk_menubar_object_path = g_strdup ( menubar_path ) ;
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_GTK_MENUBAR_OBJECT_PATH ] ) ;
2013-08-30 03:40:36 -04:00
g_free ( window - > gtk_application_object_path ) ;
window - > gtk_application_object_path = g_strdup ( application_object_path ) ;
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_GTK_APPLICATION_OBJECT_PATH ] ) ;
2013-08-30 03:40:36 -04:00
g_free ( window - > gtk_window_object_path ) ;
window - > gtk_window_object_path = g_strdup ( window_object_path ) ;
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_GTK_WINDOW_OBJECT_PATH ] ) ;
2013-08-30 03:40:36 -04:00
g_object_thaw_notify ( G_OBJECT ( window ) ) ;
}
2013-09-16 08:44:37 -04:00
2015-12-15 10:55:29 -05:00
static gboolean
check_transient_for_loop ( MetaWindow * window ,
MetaWindow * parent )
{
while ( parent )
{
2017-06-07 08:12:39 -04:00
if ( parent = = window )
2015-12-15 10:55:29 -05:00
return TRUE ;
parent = parent - > transient_for ;
}
return FALSE ;
}
2019-11-26 17:06:09 -05:00
gboolean
meta_window_has_transient_type ( MetaWindow * window )
{
return ( window - > type = = META_WINDOW_DIALOG | |
window - > type = = META_WINDOW_MODAL_DIALOG | |
window - > type = = META_WINDOW_TOOLBAR | |
window - > type = = META_WINDOW_MENU | |
window - > type = = META_WINDOW_UTILITY ) ;
}
2013-09-16 08:44:37 -04:00
void
meta_window_set_transient_for ( MetaWindow * window ,
MetaWindow * parent )
{
2015-12-15 10:55:29 -05:00
if ( check_transient_for_loop ( window , parent ) )
{
2020-10-02 11:47:22 -04:00
meta_warning ( " Setting %s transient for %s would create a loop. " ,
2015-12-15 10:55:29 -05:00
window - > desc , parent - > desc ) ;
return ;
}
2019-10-12 14:55:26 -04:00
if ( window - > appears_focused & & window - > transient_for ! = NULL )
2013-09-16 08:44:37 -04:00
meta_window_propagate_focus_appearance ( window , FALSE ) ;
/* may now be a dialog */
2014-03-13 16:49:17 -04:00
if ( window - > client_type = = META_WINDOW_CLIENT_TYPE_X11 )
2013-09-16 08:44:37 -04:00
{
2016-08-24 00:53:25 -04:00
meta_window_x11_recalc_window_type ( window ) ;
if ( ! window - > constructing )
2013-09-16 08:44:37 -04:00
{
2016-08-24 00:53:25 -04:00
/* If the window attaches, detaches, or changes attached
* parents , we need to destroy the MetaWindow and let a new one
* be created ( which happens as a side effect of
* meta_window_unmanage ( ) ) . The condition below is correct
* because we know window - > transient_for has changed .
*/
if ( window - > attached | | meta_window_should_attach_to_parent ( window ) )
{
guint32 timestamp ;
2013-09-16 08:44:37 -04:00
2016-08-24 00:53:25 -04:00
timestamp =
meta_display_get_current_time_roundtrip ( window - > display ) ;
meta_window_unmanage ( window , timestamp ) ;
return ;
}
2013-09-16 08:44:37 -04:00
}
}
2018-07-10 10:42:42 -04:00
else if ( window - > attached & & parent = = NULL )
{
guint32 timestamp ;
2013-09-16 08:44:37 -04:00
2018-07-10 10:42:42 -04:00
timestamp =
meta_display_get_current_time_roundtrip ( window - > display ) ;
2022-07-07 11:53:39 -04:00
meta_window_delete ( window , timestamp ) ;
2018-07-10 10:42:42 -04:00
return ;
}
2022-07-07 11:53:39 -04:00
2023-02-10 10:12:39 -05:00
g_set_object ( & window - > transient_for , parent ) ;
2013-09-16 08:44:37 -04:00
2023-02-10 10:12:58 -05:00
if ( window - > client_type = = META_WINDOW_CLIENT_TYPE_WAYLAND & &
window - > attached ! = meta_window_should_attach_to_parent ( window ) )
{
window - > attached = meta_window_should_attach_to_parent ( window ) ;
meta_window_recalc_features ( window ) ;
}
2015-09-24 01:35:42 -04:00
/* update stacking constraints */
if ( ! window - > override_redirect )
2017-08-26 13:03:51 -04:00
meta_stack_update_transient ( window - > display - > stack , window ) ;
2015-09-24 01:35:42 -04:00
2013-09-16 08:44:37 -04:00
/* possibly change its group. We treat being a window's transient as
* equivalent to making it your group leader , to work around shortcomings
* in programs such as xmms - - see # 328211.
*/
if ( window - > xtransient_for ! = None & &
window - > xgroup_leader ! = None & &
window - > xtransient_for ! = window - > xgroup_leader )
meta_window_group_leader_changed ( window ) ;
if ( ! window - > constructing & & ! window - > override_redirect )
2016-01-06 11:11:19 -05:00
meta_window_queue ( window , META_QUEUE_MOVE_RESIZE | META_QUEUE_CALC_SHOWING ) ;
2013-09-16 08:44:37 -04:00
2019-10-12 14:55:26 -04:00
if ( window - > appears_focused & & window - > transient_for ! = NULL )
2013-09-16 08:44:37 -04:00
meta_window_propagate_focus_appearance ( window , TRUE ) ;
}
2013-10-16 00:06:10 -04:00
2013-12-06 13:44:31 -05:00
void
meta_window_set_opacity ( MetaWindow * window ,
2014-04-10 02:41:22 -04:00
guint8 opacity )
2013-12-06 13:44:31 -05:00
{
window - > opacity = opacity ;
2014-03-18 17:06:42 -04:00
meta_compositor_window_opacity_changed ( window - > display - > compositor , window ) ;
2013-12-06 13:44:31 -05:00
}
2013-10-16 00:06:10 -04:00
typedef struct
{
MetaWindow * window ;
int pointer_x ;
int pointer_y ;
} MetaFocusData ;
static void
mouse_mode_focus ( MetaWindow * window ,
guint32 timestamp )
{
MetaDisplay * display = window - > display ;
2016-06-24 05:14:39 -04:00
if ( window - > override_redirect )
return ;
2013-10-16 00:06:10 -04:00
if ( window - > type ! = META_WINDOW_DESKTOP )
{
meta_topic ( META_DEBUG_FOCUS ,
2020-10-02 11:47:22 -04:00
" Focusing %s at time %u. " , window - > desc , timestamp ) ;
2013-10-16 00:06:10 -04:00
meta_window_focus ( window , timestamp ) ;
if ( meta_prefs_get_auto_raise ( ) )
meta_display_queue_autoraise_callback ( display , window ) ;
else
2020-10-02 11:47:22 -04:00
meta_topic ( META_DEBUG_FOCUS , " Auto raise is disabled " ) ;
2013-10-16 00:06:10 -04:00
}
else
{
/* In mouse focus mode, we defocus when the mouse *enters*
* the DESKTOP window , instead of defocusing on LeaveNotify .
* This is because having the mouse enter override - redirect
* child windows unfortunately causes LeaveNotify events that
* we can ' t distinguish from the mouse actually leaving the
* toplevel window as we expect . But , since we filter out
* EnterNotify events on override - redirect windows , this
* alternative mechanism works great .
*/
if ( meta_prefs_get_focus_mode ( ) = = G_DESKTOP_FOCUS_MODE_MOUSE & &
display - > focus_window ! = NULL )
{
meta_topic ( META_DEBUG_FOCUS ,
" Unsetting focus from %s due to mouse entering "
2020-10-02 11:47:22 -04:00
" the DESKTOP window " ,
2013-10-16 00:06:10 -04:00
display - > focus_window - > desc ) ;
2018-12-30 15:23:07 -05:00
meta_display_unset_input_focus ( display , timestamp ) ;
2013-10-16 00:06:10 -04:00
}
}
}
2016-08-25 18:51:19 -04:00
static gboolean
window_has_pointer_wayland ( MetaWindow * window )
{
2019-10-04 08:02:53 -04:00
ClutterSeat * seat ;
2016-08-25 18:51:19 -04:00
ClutterInputDevice * dev ;
2020-12-14 11:14:59 -05:00
ClutterStage * stage ;
2016-08-25 18:51:19 -04:00
ClutterActor * pointer_actor , * window_actor ;
2019-10-04 08:02:53 -04:00
seat = clutter_backend_get_default_seat ( clutter_get_default_backend ( ) ) ;
dev = clutter_seat_get_pointer ( seat ) ;
2022-05-27 16:27:07 -04:00
stage = CLUTTER_STAGE ( meta_backend_get_stage ( backend_from_window ( window ) ) ) ;
2020-12-14 11:14:59 -05:00
pointer_actor = clutter_stage_get_device_actor ( stage , dev , NULL ) ;
2016-08-25 18:51:19 -04:00
window_actor = CLUTTER_ACTOR ( meta_window_get_compositor_private ( window ) ) ;
return pointer_actor & & clutter_actor_contains ( window_actor , pointer_actor ) ;
}
static gboolean
window_has_pointer_x11 ( MetaWindow * window )
{
2017-08-26 12:56:44 -04:00
MetaX11Display * x11_display = window - > display - > x11_display ;
2016-08-25 18:51:19 -04:00
Window root , child ;
double root_x , root_y , x , y ;
XIButtonState buttons ;
XIModifierState mods ;
XIGroupState group ;
2017-08-27 14:48:55 -04:00
meta_x11_error_trap_push ( x11_display ) ;
2017-08-26 12:56:44 -04:00
XIQueryPointer ( x11_display - > xdisplay ,
2016-08-25 18:51:19 -04:00
META_VIRTUAL_CORE_POINTER_ID ,
2017-08-26 12:56:44 -04:00
x11_display - > xroot ,
2016-08-25 18:51:19 -04:00
& root , & child ,
& root_x , & root_y , & x , & y ,
& buttons , & mods , & group ) ;
2017-08-27 14:48:55 -04:00
meta_x11_error_trap_pop ( x11_display ) ;
2016-08-25 18:51:19 -04:00
free ( buttons . mask ) ;
2017-08-26 12:56:44 -04:00
return meta_x11_display_lookup_x_window ( x11_display , child ) = = window ;
2016-08-25 18:51:19 -04:00
}
2014-06-12 17:01:13 -04:00
gboolean
meta_window_has_pointer ( MetaWindow * window )
2014-05-07 17:22:41 -04:00
{
2016-08-25 18:51:19 -04:00
if ( meta_is_wayland_compositor ( ) )
return window_has_pointer_wayland ( window ) ;
else
return window_has_pointer_x11 ( window ) ;
2014-05-07 17:22:41 -04:00
}
2013-10-16 00:06:10 -04:00
static gboolean
window_focus_on_pointer_rest_callback ( gpointer data )
{
MetaFocusData * focus_data = data ;
MetaWindow * window = focus_data - > window ;
MetaDisplay * display = window - > display ;
2022-05-27 16:27:07 -04:00
MetaBackend * backend = backend_from_window ( window ) ;
2016-11-29 07:30:22 -05:00
MetaCursorTracker * cursor_tracker = meta_backend_get_cursor_tracker ( backend ) ;
2020-07-13 06:06:12 -04:00
graphene_point_t point ;
2013-10-16 00:06:10 -04:00
guint32 timestamp ;
if ( meta_prefs_get_focus_mode ( ) = = G_DESKTOP_FOCUS_MODE_CLICK )
goto out ;
2020-07-13 06:06:12 -04:00
meta_cursor_tracker_get_pointer ( cursor_tracker , & point , NULL ) ;
2013-10-16 00:06:10 -04:00
2020-07-13 06:06:12 -04:00
if ( ( int ) point . x ! = focus_data - > pointer_x | |
( int ) point . y ! = focus_data - > pointer_y )
2013-10-16 00:06:10 -04:00
{
2020-07-13 06:06:12 -04:00
focus_data - > pointer_x = point . x ;
focus_data - > pointer_y = point . y ;
2014-06-12 17:02:14 -04:00
return G_SOURCE_CONTINUE ;
2013-10-16 00:06:10 -04:00
}
2014-06-12 17:01:13 -04:00
if ( ! meta_window_has_pointer ( window ) )
2013-10-16 00:06:10 -04:00
goto out ;
timestamp = meta_display_get_current_time_roundtrip ( display ) ;
mouse_mode_focus ( window , timestamp ) ;
out :
display - > focus_timeout_id = 0 ;
2014-06-12 17:02:14 -04:00
return G_SOURCE_REMOVE ;
2013-10-16 00:06:10 -04:00
}
/* The interval, in milliseconds, we use in focus-follows-mouse
* mode to check whether the pointer has stopped moving after a
* crossing event .
*/
# define FOCUS_TIMEOUT_DELAY 25
static void
queue_focus_callback ( MetaDisplay * display ,
MetaWindow * window ,
int pointer_x ,
int pointer_y )
{
MetaFocusData * focus_data ;
focus_data = g_new ( MetaFocusData , 1 ) ;
focus_data - > window = window ;
focus_data - > pointer_x = pointer_x ;
focus_data - > pointer_y = pointer_y ;
2019-11-21 18:25:30 -05:00
g_clear_handle_id ( & display - > focus_timeout_id , g_source_remove ) ;
2013-10-16 00:06:10 -04:00
display - > focus_timeout_id =
g_timeout_add_full ( G_PRIORITY_DEFAULT ,
FOCUS_TIMEOUT_DELAY ,
window_focus_on_pointer_rest_callback ,
focus_data ,
g_free ) ;
2014-04-10 12:58:58 -04:00
g_source_set_name_by_id ( display - > focus_timeout_id ,
" [mutter] window_focus_on_pointer_rest_callback " ) ;
2013-10-16 00:06:10 -04:00
}
void
meta_window_handle_enter ( MetaWindow * window ,
guint32 timestamp ,
guint root_x ,
guint root_y )
{
MetaDisplay * display = window - > display ;
switch ( meta_prefs_get_focus_mode ( ) )
{
case G_DESKTOP_FOCUS_MODE_SLOPPY :
case G_DESKTOP_FOCUS_MODE_MOUSE :
display - > mouse_mode = TRUE ;
if ( window - > type ! = META_WINDOW_DOCK )
{
if ( meta_prefs_get_focus_change_on_pointer_rest ( ) )
queue_focus_callback ( display , window , root_x , root_y ) ;
else
mouse_mode_focus ( window , timestamp ) ;
}
break ;
case G_DESKTOP_FOCUS_MODE_CLICK :
break ;
}
2014-05-15 16:20:41 -04:00
if ( window - > type = = META_WINDOW_DOCK )
meta_window_raise ( window ) ;
}
void
meta_window_handle_leave ( MetaWindow * window )
{
if ( window - > type = = META_WINDOW_DOCK & & ! window - > has_focus )
meta_window_lower ( window ) ;
2013-10-16 00:06:10 -04:00
}
2013-11-19 17:33:57 -05:00
2014-08-15 08:29:16 -04:00
void
2014-05-08 15:12:58 -04:00
meta_window_handle_ungrabbed_event ( MetaWindow * window ,
const ClutterEvent * event )
{
MetaDisplay * display = window - > display ;
gboolean unmodified ;
2014-08-14 15:51:36 -04:00
gboolean is_window_grab ;
2019-06-24 12:11:22 -04:00
gboolean is_window_button_grab_allowed ;
2015-11-24 09:43:42 -05:00
ClutterModifierType grab_mods , event_mods ;
2019-06-24 12:11:22 -04:00
ClutterInputDevice * source ;
2015-11-24 09:43:42 -05:00
gfloat x , y ;
guint button ;
2014-05-08 15:12:58 -04:00
2021-01-20 06:22:22 -05:00
if ( window - > unmanaging )
return ;
2015-11-24 09:43:42 -05:00
if ( event - > type ! = CLUTTER_BUTTON_PRESS & &
event - > type ! = CLUTTER_TOUCH_BEGIN )
2014-08-15 08:29:16 -04:00
return ;
2014-05-08 15:12:58 -04:00
2015-11-24 09:43:42 -05:00
if ( event - > type = = CLUTTER_TOUCH_BEGIN )
{
ClutterEventSequence * sequence ;
button = 1 ;
sequence = clutter_event_get_event_sequence ( event ) ;
if ( ! meta_display_is_pointer_emulating_sequence ( window - > display , sequence ) )
return ;
}
else
button = clutter_event_get_button ( event ) ;
2014-06-02 15:37:43 -04:00
/* Some windows might not ask for input, in which case we might be here
* because we selected for ButtonPress on the root window . In that case ,
* we have to take special care not to act for an override - redirect window .
2014-07-01 14:39:09 -04:00
*/
2014-06-02 15:37:43 -04:00
if ( window - > override_redirect )
2014-08-15 08:29:16 -04:00
return ;
2014-06-02 15:37:43 -04:00
2015-10-21 11:35:36 -04:00
/* Don't focus panels--they must explicitly request focus.
* See bug 160470
*/
if ( window - > type ! = META_WINDOW_DOCK )
{
meta_topic ( META_DEBUG_FOCUS ,
2020-10-02 11:47:22 -04:00
" Focusing %s due to button %u press (display.c) " ,
2015-10-21 11:35:36 -04:00
window - > desc , button ) ;
meta_window_focus ( window , event - > any . time ) ;
window: Check aliveness a bit less aggressively
Currently we check whether a window is alive everytime it's focused.
This means that an application that doesn't respond to the check-alive
event during startup always showing the "application froze" dialog,
without the user ever trying to interact with it.
An example where this tends to to happen is with games, and for this
particular scenario, it's purely an annoyance, as I never tried to
interact with the game window in the first place, so I don't care that
it's not responding - it's loading.
To avoid these unnecessary particular "app-is-frozen" popups, remove the
alive check from the focus function, and instead move it back to the
"meta_window_activate_full()" call. To also trigger it slightly more
often, also add it to the path that triggers the window focus when a
user actively clicks on the window.
This means that we currently check whether a window is alive on:
* Any time the window is activated. This means e.g. alt-tab or
selecting the window in the overview.
* The user clicks on the window.
Note that the second only works for an already focused window on
Wayland, as on X11, we don't refocus it. This particular case isn't
changed with this commit, as we didn't call meta_window_focus() to begin
with here.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1182
2020-04-07 04:39:10 -04:00
meta_window_check_alive ( window , event - > any . time ) ;
2015-10-21 11:35:36 -04:00
}
else
/* However, do allow terminals to lose focus due to new
* window mappings after the user clicks on a panel .
*/
display - > allow_terminal_deactivation = TRUE ;
2014-05-08 15:12:58 -04:00
/* We have three passive button grabs:
* - on any button , without modifiers = > focuses and maybe raises the window
* - on resize button , with modifiers = > start an interactive resizing
* ( normally < Super > middle )
* - on move button , with modifiers = > start an interactive move
* ( normally < Super > left )
* - on menu button , with modifiers = > show the window menu
* ( normally < Super > right )
*
* We may get here because we actually have a button
* grab on the window , or because we ' re a wayland
* compositor and thus we see all the events , so we
* need to check if the event is interesting .
* We want an event that is not modified for a window .
*
* We may have other events on the window , for example
* a click on a frame button , but that ' s not for us to
* care about . Just let the event through .
*/
2021-01-29 14:56:46 -05:00
grab_mods = meta_display_get_compositor_modifiers ( display ) ;
2015-11-24 09:43:42 -05:00
event_mods = clutter_event_get_state ( event ) ;
unmodified = ( event_mods & grab_mods ) = = 0 ;
2019-06-24 12:11:22 -04:00
source = clutter_event_get_source_device ( event ) ;
2019-07-03 12:11:46 -04:00
is_window_button_grab_allowed = ! display - > focus_window | |
2019-06-24 12:11:22 -04:00
! meta_window_shortcuts_inhibited ( display - > focus_window , source ) ;
is_window_grab = ( is_window_button_grab_allowed & &
( ( event_mods & grab_mods ) = = grab_mods ) ) ;
2015-11-24 09:43:42 -05:00
clutter_event_get_coords ( event , & x , & y ) ;
2014-05-08 15:12:58 -04:00
if ( unmodified )
{
if ( meta_prefs_get_raise_on_click ( ) )
meta_window_raise ( window ) ;
else
meta_topic ( META_DEBUG_FOCUS ,
2020-10-02 11:47:22 -04:00
" Not raising window on click due to don't-raise-on-click option " ) ;
2014-05-08 15:12:58 -04:00
}
2015-11-24 09:43:42 -05:00
else if ( is_window_grab & & ( int ) button = = meta_prefs_get_mouse_button_resize ( ) )
2014-05-08 15:12:58 -04:00
{
if ( window - > has_resize_func )
{
gboolean north , south ;
gboolean west , east ;
MetaRectangle frame_rect ;
2014-08-15 14:05:04 -04:00
MetaGrabOp op = META_GRAB_OP_WINDOW_BASE ;
2014-05-08 15:12:58 -04:00
meta_window_get_frame_rect ( window , & frame_rect ) ;
2015-11-24 09:43:42 -05:00
west = x < ( frame_rect . x + 1 * frame_rect . width / 3 ) ;
east = x > ( frame_rect . x + 2 * frame_rect . width / 3 ) ;
north = y < ( frame_rect . y + 1 * frame_rect . height / 3 ) ;
south = y > ( frame_rect . y + 2 * frame_rect . height / 3 ) ;
2014-05-08 15:12:58 -04:00
2014-08-15 14:05:04 -04:00
if ( west )
op | = META_GRAB_OP_WINDOW_DIR_WEST ;
if ( east )
op | = META_GRAB_OP_WINDOW_DIR_EAST ;
if ( north )
op | = META_GRAB_OP_WINDOW_DIR_NORTH ;
if ( south )
op | = META_GRAB_OP_WINDOW_DIR_SOUTH ;
if ( op ! = META_GRAB_OP_WINDOW_BASE )
2022-09-29 12:50:09 -04:00
{
2022-09-29 13:21:50 -04:00
op | = META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED ;
2022-09-29 12:50:09 -04:00
meta_window_begin_grab_op ( window ,
op ,
2022-10-21 13:52:35 -04:00
clutter_event_get_device ( event ) ,
clutter_event_get_event_sequence ( event ) ,
2022-09-29 12:50:09 -04:00
event - > any . time ) ;
}
2014-05-08 15:12:58 -04:00
}
}
2015-11-24 09:43:42 -05:00
else if ( is_window_grab & & ( int ) button = = meta_prefs_get_mouse_button_menu ( ) )
2014-05-08 15:12:58 -04:00
{
if ( meta_prefs_get_raise_on_click ( ) )
meta_window_raise ( window ) ;
2014-05-22 08:35:11 -04:00
meta_window_show_menu ( window ,
2014-05-23 17:14:51 -04:00
META_WINDOW_MENU_WM ,
2015-11-24 09:43:42 -05:00
x , y ) ;
2014-05-08 15:12:58 -04:00
}
2015-11-24 09:43:42 -05:00
else if ( is_window_grab & & ( int ) button = = 1 )
2014-05-08 15:12:58 -04:00
{
if ( window - > has_move_func )
{
2022-09-29 12:50:09 -04:00
meta_window_begin_grab_op ( window ,
2022-09-29 13:21:50 -04:00
META_GRAB_OP_MOVING |
META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED ,
2022-10-21 13:52:35 -04:00
clutter_event_get_device ( event ) ,
clutter_event_get_event_sequence ( event ) ,
2022-09-29 12:50:09 -04:00
event - > any . time ) ;
2014-05-08 15:12:58 -04:00
}
}
}
2014-03-13 18:15:26 -04:00
gboolean
meta_window_can_maximize ( MetaWindow * window )
{
return window - > has_maximize_func ;
}
gboolean
meta_window_can_minimize ( MetaWindow * window )
{
return window - > has_minimize_func ;
}
gboolean
meta_window_can_shade ( MetaWindow * window )
{
return window - > has_shade_func ;
}
gboolean
meta_window_can_close ( MetaWindow * window )
{
return window - > has_close_func ;
}
gboolean
meta_window_is_always_on_all_workspaces ( MetaWindow * window )
{
return window - > always_sticky ;
}
gboolean
meta_window_is_above ( MetaWindow * window )
{
return window - > wm_state_above ;
}
gboolean
meta_window_allows_move ( MetaWindow * window )
{
return META_WINDOW_ALLOWS_MOVE ( window ) ;
}
gboolean
meta_window_allows_resize ( MetaWindow * window )
{
return META_WINDOW_ALLOWS_RESIZE ( window ) ;
}
2014-03-18 13:51:36 -04:00
void
meta_window_set_urgent ( MetaWindow * window ,
gboolean urgent )
{
2014-03-18 13:53:42 -04:00
if ( window - > urgent = = urgent )
2014-03-18 13:51:36 -04:00
return ;
2014-03-18 13:53:42 -04:00
window - > urgent = urgent ;
2014-06-24 16:25:41 -04:00
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_URGENT ] ) ;
2014-03-18 13:51:36 -04:00
if ( urgent )
g_signal_emit_by_name ( window - > display , " window-marked-urgent " , window ) ;
}
2014-04-29 15:30:21 -04:00
void
meta_window_grab_op_began ( MetaWindow * window ,
MetaGrabOp op )
{
2014-04-29 15:55:55 -04:00
META_WINDOW_GET_CLASS ( window ) - > grab_op_began ( window , op ) ;
2014-04-29 15:30:21 -04:00
}
void
meta_window_grab_op_ended ( MetaWindow * window ,
MetaGrabOp op )
{
2014-04-29 15:55:55 -04:00
META_WINDOW_GET_CLASS ( window ) - > grab_op_ended ( window , op ) ;
2014-04-29 15:30:21 -04:00
}
2015-03-23 09:22:19 -04:00
void
meta_window_emit_size_changed ( MetaWindow * window )
{
g_signal_emit ( window , window_signals [ SIZE_CHANGED ] , 0 ) ;
}
2016-02-01 05:46:11 -05:00
MetaPlacementRule *
meta_window_get_placement_rule ( MetaWindow * window )
{
2020-02-13 16:40:15 -05:00
return window - > placement . rule ;
2016-02-01 05:46:11 -05:00
}
2017-03-17 08:34:52 -04:00
void
meta_window_force_restore_shortcuts ( MetaWindow * window ,
ClutterInputDevice * source )
{
META_WINDOW_GET_CLASS ( window ) - > force_restore_shortcuts ( window , source ) ;
}
gboolean
meta_window_shortcuts_inhibited ( MetaWindow * window ,
ClutterInputDevice * source )
{
return META_WINDOW_GET_CLASS ( window ) - > shortcuts_inhibited ( window , source ) ;
}
2018-01-09 07:19:40 -05:00
2018-11-13 02:56:53 -05:00
gboolean
meta_window_is_focusable ( MetaWindow * window )
{
2019-02-14 07:57:22 -05:00
g_return_val_if_fail ( ! window - > unmanaging , FALSE ) ;
2018-11-13 02:56:53 -05:00
return META_WINDOW_GET_CLASS ( window ) - > is_focusable ( window ) ;
}
2019-01-30 14:41:11 -05:00
gboolean
meta_window_can_ping ( MetaWindow * window )
{
2021-01-20 05:55:10 -05:00
g_return_val_if_fail ( ! window - > unmanaging , FALSE ) ;
2019-01-30 14:41:11 -05:00
return META_WINDOW_GET_CLASS ( window ) - > can_ping ( window ) ;
}
2018-01-09 07:19:40 -05:00
gboolean
meta_window_is_stackable ( MetaWindow * window )
{
return META_WINDOW_GET_CLASS ( window ) - > is_stackable ( window ) ;
}
2018-09-21 11:49:36 -04:00
2021-02-11 11:53:59 -05:00
gboolean
meta_window_is_focus_async ( MetaWindow * window )
{
return META_WINDOW_GET_CLASS ( window ) - > is_focus_async ( window ) ;
}
2019-11-26 14:53:24 -05:00
MetaStackLayer
meta_window_calculate_layer ( MetaWindow * window )
{
return META_WINDOW_GET_CLASS ( window ) - > calculate_layer ( window ) ;
}
2022-05-18 07:51:44 -04:00
# ifdef HAVE_WAYLAND
MetaWaylandSurface *
meta_window_get_wayland_surface ( MetaWindow * window )
{
MetaWindowClass * klass = META_WINDOW_GET_CLASS ( window ) ;
g_return_val_if_fail ( klass - > get_wayland_surface ! = NULL , NULL ) ;
return klass - > get_wayland_surface ( window ) ;
}
# endif
2018-09-21 11:49:36 -04:00
/**
* meta_window_get_id :
* @ window : a # MetaWindow
*
* Returns the window id associated with window .
*
2018-12-14 09:55:36 -05:00
* Returns : The window id
2018-09-21 11:49:36 -04:00
*/
uint64_t
meta_window_get_id ( MetaWindow * window )
{
return window - > id ;
}
2018-12-12 07:05:21 -05:00
/**
* meta_window_get_client_type :
* @ window : a # MetaWindow
*
* Returns the # MetaWindowClientType of the window .
*
2018-12-14 09:55:36 -05:00
* Returns : The root ancestor window
2018-12-12 07:05:21 -05:00
*/
MetaWindowClientType
meta_window_get_client_type ( MetaWindow * window )
{
return window - > client_type ;
}
2021-09-03 17:38:12 -04:00
static gboolean
meta_window_close_dialog_timeout ( MetaWindow * window )
{
meta_window_show_close_dialog ( window ) ;
window - > close_dialog_timeout_id = 0 ;
return G_SOURCE_REMOVE ;
}
void
meta_window_ensure_close_dialog_timeout ( MetaWindow * window )
{
guint check_alive_timeout = meta_prefs_get_check_alive_timeout ( ) ;
if ( window - > is_alive )
return ;
if ( window - > close_dialog_timeout_id ! = 0 )
return ;
if ( check_alive_timeout = = 0 )
return ;
window - > close_dialog_timeout_id =
g_timeout_add ( check_alive_timeout ,
( GSourceFunc ) meta_window_close_dialog_timeout ,
window ) ;
g_source_set_name_by_id ( window - > close_dialog_timeout_id ,
" [mutter] meta_window_close_dialog_timeout " ) ;
}
void
meta_window_set_alive ( MetaWindow * window ,
gboolean is_alive )
{
if ( window - > is_alive = = is_alive )
return ;
window - > is_alive = is_alive ;
g_object_notify_by_pspec ( G_OBJECT ( window ) , obj_props [ PROP_IS_ALIVE ] ) ;
if ( is_alive )
{
g_clear_handle_id ( & window - > close_dialog_timeout_id , g_source_remove ) ;
meta_window_hide_close_dialog ( window ) ;
}
}
gboolean
meta_window_get_alive ( MetaWindow * window )
{
return window - > is_alive ;
}
2021-12-17 15:42:35 -05:00
gboolean
meta_window_calculate_bounds ( MetaWindow * window ,
int * bounds_width ,
int * bounds_height )
{
MetaLogicalMonitor * main_monitor ;
main_monitor = meta_window_get_main_logical_monitor ( window ) ;
if ( main_monitor )
{
MetaRectangle work_area ;
meta_window_get_work_area_for_logical_monitor ( window ,
main_monitor ,
& work_area ) ;
* bounds_width = work_area . width ;
* bounds_height = work_area . height ;
return TRUE ;
}
else
{
return FALSE ;
}
}