2006-10-01 18:30:10 -04:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
2013-02-15 13:42:08 -05:00
|
|
|
/*
|
2011-11-02 11:34:45 -04:00
|
|
|
* SECTION:window-props
|
|
|
|
* @short_description: #MetaWindow property handling
|
2008-06-13 19:10:32 -04:00
|
|
|
*
|
|
|
|
* A system which can inspect sets of properties of given windows
|
|
|
|
* and take appropriate action given their values.
|
|
|
|
*
|
|
|
|
* Note that all the meta_window_reload_propert* functions require a
|
|
|
|
* round trip to the server.
|
|
|
|
*
|
2009-01-29 09:32:31 -05:00
|
|
|
* The guts of this system are in meta_display_init_window_prop_hooks().
|
|
|
|
* Reading this function will give you insight into how this all fits
|
|
|
|
* together.
|
2008-06-13 19:10:32 -04:00
|
|
|
*/
|
2002-11-03 18:42:21 -05:00
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
/*
|
2003-02-27 20:24:44 -05:00
|
|
|
* Copyright (C) 2001, 2002, 2003 Red Hat, Inc.
|
2005-10-08 15:38:54 -04:00
|
|
|
* Copyright (C) 2004, 2005 Elijah Newren
|
2009-01-29 09:32:31 -05:00
|
|
|
* Copyright (C) 2009 Thomas Thurman
|
2014-05-02 09:34:02 -04:00
|
|
|
*
|
2002-11-03 18:42:21 -05:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
2014-05-02 09:34:02 -04:00
|
|
|
*
|
2002-11-03 18:42:21 -05: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/>.
|
2002-11-03 18:42:21 -05:00
|
|
|
*/
|
|
|
|
|
2019-06-23 12:02:41 -04:00
|
|
|
#define _XOPEN_SOURCE 600 /* for gethostname() */
|
2008-02-26 23:39:10 -05:00
|
|
|
|
2018-07-10 04:36:24 -04:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "x11/window-props.h"
|
|
|
|
|
2002-11-03 18:42:21 -05:00
|
|
|
#include <X11/Xatom.h>
|
2005-11-23 12:08:03 -05:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
2018-07-10 04:36:24 -04:00
|
|
|
|
|
|
|
#include "core/frame.h"
|
|
|
|
#include "core/meta-workspace-manager-private.h"
|
|
|
|
#include "core/util-private.h"
|
|
|
|
#include "meta/group.h"
|
|
|
|
#include "meta/meta-x11-errors.h"
|
|
|
|
#include "x11/meta-x11-display-private.h"
|
|
|
|
#include "x11/window-x11-private.h"
|
|
|
|
#include "x11/window-x11.h"
|
|
|
|
#include "x11/xprops.h"
|
2002-11-03 18:42:21 -05:00
|
|
|
|
2013-02-20 15:17:21 -05:00
|
|
|
#ifndef HOST_NAME_MAX
|
|
|
|
/* Solaris headers apparently don't define this so do so manually; #326745 */
|
|
|
|
#define HOST_NAME_MAX 255
|
|
|
|
#endif
|
|
|
|
|
2002-11-03 18:42:21 -05:00
|
|
|
typedef void (* ReloadValueFunc) (MetaWindow *window,
|
2009-01-26 22:53:07 -05:00
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial);
|
2002-11-03 18:42:21 -05:00
|
|
|
|
2018-12-19 03:04:25 -05:00
|
|
|
typedef enum
|
|
|
|
{
|
2014-07-10 14:31:25 -04:00
|
|
|
NONE = 0,
|
|
|
|
LOAD_INIT = (1 << 0),
|
|
|
|
INCLUDE_OR = (1 << 1),
|
2014-07-10 14:33:49 -04:00
|
|
|
INIT_ONLY = (1 << 2),
|
2014-08-01 09:23:47 -04:00
|
|
|
FORCE_INIT = (1 << 3),
|
2014-07-10 14:31:25 -04:00
|
|
|
} MetaPropHookFlags;
|
|
|
|
|
2009-06-14 08:37:57 -04:00
|
|
|
struct _MetaWindowPropHooks
|
2002-11-03 18:42:21 -05:00
|
|
|
{
|
|
|
|
Atom property;
|
2009-01-29 09:32:31 -05:00
|
|
|
MetaPropValueType type;
|
2002-11-03 18:42:21 -05:00
|
|
|
ReloadValueFunc reload_func;
|
2014-07-10 14:31:25 -04:00
|
|
|
MetaPropHookFlags flags;
|
2009-06-14 08:37:57 -04:00
|
|
|
};
|
2002-11-03 18:42:21 -05:00
|
|
|
|
2009-06-14 08:37:57 -04:00
|
|
|
static void init_prop_value (MetaWindow *window,
|
2009-06-15 13:24:43 -04:00
|
|
|
MetaWindowPropHooks *hooks,
|
|
|
|
MetaPropValue *value);
|
|
|
|
static void reload_prop_value (MetaWindow *window,
|
|
|
|
MetaWindowPropHooks *hooks,
|
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial);
|
2017-08-26 12:58:29 -04:00
|
|
|
static MetaWindowPropHooks *find_hooks (MetaX11Display *x11_display,
|
|
|
|
Atom property);
|
2002-11-03 18:42:21 -05:00
|
|
|
|
|
|
|
|
|
|
|
void
|
2009-06-28 18:32:27 -04:00
|
|
|
meta_window_reload_property_from_xwindow (MetaWindow *window,
|
|
|
|
Window xwindow,
|
|
|
|
Atom property,
|
|
|
|
gboolean initial)
|
2002-11-03 18:42:21 -05:00
|
|
|
{
|
2009-06-28 18:32:27 -04:00
|
|
|
MetaPropValue value = { 0, };
|
|
|
|
MetaWindowPropHooks *hooks;
|
2002-11-03 18:42:21 -05:00
|
|
|
|
2017-08-26 12:58:29 -04:00
|
|
|
hooks = find_hooks (window->display->x11_display, property);
|
2009-06-28 18:32:27 -04:00
|
|
|
if (!hooks)
|
|
|
|
return;
|
2007-03-31 01:19:41 -04:00
|
|
|
|
2014-07-10 14:33:49 -04:00
|
|
|
if ((hooks->flags & INIT_ONLY) && !initial)
|
|
|
|
return;
|
|
|
|
|
2009-06-28 18:32:27 -04:00
|
|
|
init_prop_value (window, hooks, &value);
|
2007-03-31 01:19:41 -04:00
|
|
|
|
2017-08-26 14:51:28 -04:00
|
|
|
meta_prop_get_values (window->display->x11_display, xwindow,
|
2009-06-28 18:32:27 -04:00
|
|
|
&value, 1);
|
2002-11-03 18:42:21 -05:00
|
|
|
|
2009-06-28 18:32:27 -04:00
|
|
|
reload_prop_value (window, hooks, &value,
|
|
|
|
initial);
|
|
|
|
|
|
|
|
meta_prop_free_values (&value, 1);
|
|
|
|
}
|
2002-11-03 18:42:21 -05:00
|
|
|
|
2009-06-28 18:32:27 -04:00
|
|
|
static void
|
|
|
|
meta_window_reload_property (MetaWindow *window,
|
|
|
|
Atom property,
|
|
|
|
gboolean initial)
|
|
|
|
{
|
|
|
|
meta_window_reload_property_from_xwindow (window,
|
|
|
|
window->xwindow,
|
|
|
|
property,
|
|
|
|
initial);
|
2002-11-03 18:42:21 -05:00
|
|
|
}
|
|
|
|
|
2009-06-14 08:37:57 -04:00
|
|
|
void
|
|
|
|
meta_window_load_initial_properties (MetaWindow *window)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
MetaPropValue *values;
|
|
|
|
int n_properties = 0;
|
2017-08-26 12:58:29 -04:00
|
|
|
MetaX11Display *x11_display = window->display->x11_display;
|
2009-06-14 08:37:57 -04:00
|
|
|
|
2017-08-26 12:58:29 -04:00
|
|
|
values = g_new0 (MetaPropValue, x11_display->n_prop_hooks);
|
2009-06-14 08:37:57 -04:00
|
|
|
|
|
|
|
j = 0;
|
2017-08-26 12:58:29 -04:00
|
|
|
for (i = 0; i < x11_display->n_prop_hooks; i++)
|
2009-06-14 08:37:57 -04:00
|
|
|
{
|
2017-08-26 12:58:29 -04:00
|
|
|
MetaWindowPropHooks *hooks = &x11_display->prop_hooks_table[i];
|
2014-07-10 14:31:25 -04:00
|
|
|
if (hooks->flags & LOAD_INIT)
|
2009-06-14 08:37:57 -04:00
|
|
|
{
|
|
|
|
init_prop_value (window, hooks, &values[j]);
|
|
|
|
++j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
n_properties = j;
|
|
|
|
|
2017-08-26 14:51:28 -04:00
|
|
|
meta_prop_get_values (window->display->x11_display, window->xwindow,
|
2009-06-14 08:37:57 -04:00
|
|
|
values, n_properties);
|
|
|
|
|
|
|
|
j = 0;
|
2017-08-26 12:58:29 -04:00
|
|
|
for (i = 0; i < x11_display->n_prop_hooks; i++)
|
2009-06-14 08:37:57 -04:00
|
|
|
{
|
2017-08-26 12:58:29 -04:00
|
|
|
MetaWindowPropHooks *hooks = &x11_display->prop_hooks_table[i];
|
2014-07-10 14:31:25 -04:00
|
|
|
if (hooks->flags & LOAD_INIT)
|
2009-06-14 08:37:57 -04:00
|
|
|
{
|
|
|
|
/* If we didn't actually manage to load anything then we don't need
|
|
|
|
* to call the reload function; this is different from a notification
|
|
|
|
* where disappearance of a previously present value is significant.
|
|
|
|
*/
|
2014-08-01 09:23:47 -04:00
|
|
|
if (values[j].type != META_PROP_VALUE_INVALID ||
|
|
|
|
hooks->flags & FORCE_INIT)
|
2009-06-14 08:37:57 -04:00
|
|
|
reload_prop_value (window, hooks, &values[j], TRUE);
|
|
|
|
++j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_prop_free_values (values, n_properties);
|
|
|
|
|
|
|
|
g_free (values);
|
|
|
|
}
|
|
|
|
|
2002-11-03 18:42:21 -05:00
|
|
|
/* Fill in the MetaPropValue used to get the value of "property" */
|
|
|
|
static void
|
2009-06-14 08:37:57 -04:00
|
|
|
init_prop_value (MetaWindow *window,
|
2009-06-15 13:24:43 -04:00
|
|
|
MetaWindowPropHooks *hooks,
|
|
|
|
MetaPropValue *value)
|
2002-11-03 18:42:21 -05:00
|
|
|
{
|
2009-06-14 08:37:57 -04:00
|
|
|
if (!hooks || hooks->type == META_PROP_VALUE_INVALID ||
|
2014-07-10 14:31:25 -04:00
|
|
|
(window->override_redirect && !(hooks->flags & INCLUDE_OR)))
|
2009-01-29 09:32:31 -05:00
|
|
|
{
|
2009-06-15 13:24:43 -04:00
|
|
|
value->type = META_PROP_VALUE_INVALID;
|
|
|
|
value->atom = None;
|
2009-01-29 09:32:31 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
value->type = hooks->type;
|
2009-06-15 13:24:43 -04:00
|
|
|
value->atom = hooks->property;
|
2009-01-29 09:32:31 -05:00
|
|
|
}
|
2002-11-03 18:42:21 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-06-15 13:24:43 -04:00
|
|
|
reload_prop_value (MetaWindow *window,
|
|
|
|
MetaWindowPropHooks *hooks,
|
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
2002-11-03 18:42:21 -05:00
|
|
|
{
|
2014-07-10 14:31:25 -04:00
|
|
|
if (!(window->override_redirect && !(hooks->flags & INCLUDE_OR)))
|
2009-01-26 22:53:07 -05:00
|
|
|
(* hooks->reload_func) (window, value, initial);
|
2002-11-03 18:42:21 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reload_wm_client_machine (MetaWindow *window,
|
2009-01-26 22:53:07 -05:00
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
2002-11-03 18:42:21 -05:00
|
|
|
{
|
|
|
|
g_free (window->wm_client_machine);
|
|
|
|
window->wm_client_machine = NULL;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-11-03 18:42:21 -05:00
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
|
|
|
window->wm_client_machine = g_strdup (value->v.str);
|
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Window has client machine \"%s\"",
|
2002-11-03 18:42:21 -05:00
|
|
|
window->wm_client_machine ? window->wm_client_machine : "unset");
|
2013-02-20 15:17:21 -05:00
|
|
|
|
|
|
|
if (window->wm_client_machine == NULL)
|
|
|
|
{
|
|
|
|
window->is_remote = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char hostname[HOST_NAME_MAX + 1] = "";
|
|
|
|
|
|
|
|
gethostname (hostname, HOST_NAME_MAX + 1);
|
|
|
|
|
|
|
|
window->is_remote = g_strcmp0 (window->wm_client_machine, hostname) != 0;
|
|
|
|
}
|
2002-11-03 18:42:21 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-01-27 00:03:06 -05:00
|
|
|
complain_about_broken_client (MetaWindow *window,
|
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_warning ("Broken client! Window %s changed client leader window or SM client ID",
|
2009-01-27 00:03:06 -05:00
|
|
|
window->desc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reload_net_wm_window_type (MetaWindow *window,
|
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
|
|
|
{
|
2017-08-26 12:26:30 -04:00
|
|
|
MetaX11Display *x11_display = window->display->x11_display;
|
2014-07-10 15:00:38 -04:00
|
|
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
2019-08-20 15:38:35 -04:00
|
|
|
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
2014-07-10 15:00:38 -04:00
|
|
|
|
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < value->v.atom_list.n_atoms; i++)
|
|
|
|
{
|
|
|
|
Atom atom = value->v.atom_list.atoms[i];
|
|
|
|
|
|
|
|
/* We break as soon as we find one we recognize,
|
|
|
|
* supposed to prefer those near the front of the list
|
|
|
|
*/
|
2017-08-26 12:26:30 -04:00
|
|
|
if (atom == x11_display->atom__NET_WM_WINDOW_TYPE_DESKTOP ||
|
|
|
|
atom == x11_display->atom__NET_WM_WINDOW_TYPE_DOCK ||
|
|
|
|
atom == x11_display->atom__NET_WM_WINDOW_TYPE_TOOLBAR ||
|
|
|
|
atom == x11_display->atom__NET_WM_WINDOW_TYPE_MENU ||
|
|
|
|
atom == x11_display->atom__NET_WM_WINDOW_TYPE_UTILITY ||
|
|
|
|
atom == x11_display->atom__NET_WM_WINDOW_TYPE_SPLASH ||
|
|
|
|
atom == x11_display->atom__NET_WM_WINDOW_TYPE_DIALOG ||
|
|
|
|
atom == x11_display->atom__NET_WM_WINDOW_TYPE_DROPDOWN_MENU ||
|
|
|
|
atom == x11_display->atom__NET_WM_WINDOW_TYPE_POPUP_MENU ||
|
|
|
|
atom == x11_display->atom__NET_WM_WINDOW_TYPE_TOOLTIP ||
|
|
|
|
atom == x11_display->atom__NET_WM_WINDOW_TYPE_NOTIFICATION ||
|
|
|
|
atom == x11_display->atom__NET_WM_WINDOW_TYPE_COMBO ||
|
|
|
|
atom == x11_display->atom__NET_WM_WINDOW_TYPE_DND ||
|
|
|
|
atom == x11_display->atom__NET_WM_WINDOW_TYPE_NORMAL)
|
2014-07-10 15:00:38 -04:00
|
|
|
{
|
|
|
|
priv->type_atom = atom;
|
2014-07-10 17:07:52 -04:00
|
|
|
break;
|
2014-07-10 15:00:38 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-07-10 17:07:52 -04:00
|
|
|
|
|
|
|
meta_window_x11_recalc_window_type (window);
|
2009-01-27 00:03:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reload_icon (MetaWindow *window,
|
|
|
|
Atom atom)
|
|
|
|
{
|
2014-07-14 12:01:22 -04:00
|
|
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
2019-08-20 15:38:35 -04:00
|
|
|
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
2014-07-14 12:01:22 -04:00
|
|
|
|
|
|
|
meta_icon_cache_property_changed (&priv->icon_cache,
|
2017-08-26 14:54:39 -04:00
|
|
|
window->display->x11_display,
|
2009-01-27 00:03:06 -05:00
|
|
|
atom);
|
2022-01-28 18:02:24 -05:00
|
|
|
meta_window_x11_queue_update_icon (window_x11);
|
2009-01-27 00:03:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reload_net_wm_icon (MetaWindow *window,
|
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
|
|
|
{
|
2017-08-26 12:26:30 -04:00
|
|
|
reload_icon (window, window->display->x11_display->atom__NET_WM_ICON);
|
2009-01-27 00:03:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reload_kwm_win_icon (MetaWindow *window,
|
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
|
|
|
{
|
2017-08-26 12:26:30 -04:00
|
|
|
reload_icon (window, window->display->x11_display->atom__KWM_WIN_ICON);
|
2009-01-27 00:03:06 -05:00
|
|
|
}
|
|
|
|
|
2013-02-01 05:32:53 -05:00
|
|
|
static void
|
|
|
|
reload_icon_geometry (MetaWindow *window,
|
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
|
|
|
{
|
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
|
|
|
{
|
|
|
|
if (value->v.cardinal_list.n_cardinals != 4)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("_NET_WM_ICON_GEOMETRY on %s has %d values instead of 4",
|
2013-02-01 05:32:53 -05:00
|
|
|
window->desc, value->v.cardinal_list.n_cardinals);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-01-22 19:11:23 -05:00
|
|
|
MetaRectangle geometry;
|
|
|
|
|
|
|
|
geometry.x = (int)value->v.cardinal_list.cardinals[0];
|
|
|
|
geometry.y = (int)value->v.cardinal_list.cardinals[1];
|
|
|
|
geometry.width = (int)value->v.cardinal_list.cardinals[2];
|
|
|
|
geometry.height = (int)value->v.cardinal_list.cardinals[3];
|
|
|
|
|
|
|
|
meta_window_set_icon_geometry (window, &geometry);
|
2013-02-01 05:32:53 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-01-22 19:11:23 -05:00
|
|
|
meta_window_set_icon_geometry (window, NULL);
|
2013-02-01 05:32:53 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-17 14:17:57 -04:00
|
|
|
static void
|
|
|
|
meta_window_set_custom_frame_extents (MetaWindow *window,
|
2014-09-17 14:17:01 -04:00
|
|
|
GtkBorder *extents,
|
|
|
|
gboolean is_initial)
|
2014-09-17 14:17:57 -04:00
|
|
|
{
|
|
|
|
if (extents)
|
|
|
|
{
|
2015-02-13 17:54:37 -05:00
|
|
|
if (window->has_custom_frame_extents &&
|
|
|
|
memcmp (&window->custom_frame_extents, extents, sizeof (GtkBorder)) == 0)
|
2014-09-17 12:41:14 -04:00
|
|
|
return;
|
|
|
|
|
2014-09-17 14:17:57 -04:00
|
|
|
window->has_custom_frame_extents = TRUE;
|
|
|
|
window->custom_frame_extents = *extents;
|
2014-09-17 14:17:01 -04:00
|
|
|
|
|
|
|
/* If we're setting the frame extents on map, then this is telling
|
|
|
|
* us to adjust our understanding of the frame rect to match what
|
|
|
|
* GTK+ thinks it is. Future changes to the frame extents should
|
|
|
|
* trigger a resize and send a ConfigureRequest to the application.
|
|
|
|
*/
|
|
|
|
if (is_initial)
|
|
|
|
{
|
|
|
|
meta_window_client_rect_to_frame_rect (window, &window->rect, &window->rect);
|
|
|
|
meta_window_client_rect_to_frame_rect (window, &window->unconstrained_rect, &window->unconstrained_rect);
|
|
|
|
}
|
2014-09-17 14:17:57 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-17 12:41:14 -04:00
|
|
|
if (!window->has_custom_frame_extents)
|
|
|
|
return;
|
|
|
|
|
2014-09-17 14:17:57 -04:00
|
|
|
window->has_custom_frame_extents = FALSE;
|
|
|
|
memset (&window->custom_frame_extents, 0, sizeof (window->custom_frame_extents));
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
|
|
|
|
}
|
|
|
|
|
2013-08-08 16:58:20 -04:00
|
|
|
static void
|
|
|
|
reload_gtk_frame_extents (MetaWindow *window,
|
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
|
|
|
{
|
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
|
|
|
{
|
|
|
|
if (value->v.cardinal_list.n_cardinals != 4)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("_GTK_FRAME_EXTENTS on %s has %d values instead of 4",
|
2013-08-08 16:58:20 -04:00
|
|
|
window->desc, value->v.cardinal_list.n_cardinals);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-02-07 17:29:35 -05:00
|
|
|
GtkBorder extents;
|
|
|
|
extents.left = (int)value->v.cardinal_list.cardinals[0];
|
|
|
|
extents.right = (int)value->v.cardinal_list.cardinals[1];
|
|
|
|
extents.top = (int)value->v.cardinal_list.cardinals[2];
|
|
|
|
extents.bottom = (int)value->v.cardinal_list.cardinals[3];
|
2014-09-17 14:17:01 -04:00
|
|
|
meta_window_set_custom_frame_extents (window, &extents, initial);
|
2013-08-08 16:58:20 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-17 14:17:01 -04:00
|
|
|
meta_window_set_custom_frame_extents (window, NULL, initial);
|
2013-08-08 16:58:20 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-27 00:03:06 -05:00
|
|
|
static void
|
|
|
|
reload_struts (MetaWindow *window,
|
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
|
|
|
{
|
|
|
|
meta_window_update_struts (window);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reload_wm_window_role (MetaWindow *window,
|
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
2002-11-03 18:42:21 -05:00
|
|
|
{
|
2014-07-10 14:55:24 -04:00
|
|
|
g_clear_pointer (&window->role, g_free);
|
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
|
|
|
window->role = g_strdup (value->v.str);
|
2002-11-03 18:42:21 -05: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
|
|
|
static void
|
|
|
|
reload_net_wm_user_time (MetaWindow *window,
|
2009-01-26 22:53:07 -05:00
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
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 (value->type != META_PROP_VALUE_INVALID)
|
|
|
|
{
|
2015-06-23 18:09:07 -04:00
|
|
|
uint32_t cardinal = value->v.cardinal;
|
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, cardinal);
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-31 01:19:41 -04:00
|
|
|
static void
|
|
|
|
reload_net_wm_user_time_window (MetaWindow *window,
|
2009-01-26 22:53:07 -05:00
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
2007-03-31 01:19:41 -04:00
|
|
|
{
|
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
|
|
|
{
|
2016-11-11 14:29:59 -05:00
|
|
|
MetaWindow *prev_owner;
|
|
|
|
|
2007-03-31 01:19:41 -04:00
|
|
|
/* Unregister old NET_WM_USER_TIME_WINDOW */
|
|
|
|
if (window->user_time_window != None)
|
|
|
|
{
|
|
|
|
/* See the comment to the meta_display_register_x_window call below. */
|
2017-08-26 12:56:44 -04:00
|
|
|
meta_x11_display_unregister_x_window (window->display->x11_display,
|
|
|
|
window->user_time_window);
|
2007-03-31 01:19:41 -04:00
|
|
|
/* Don't get events on not-managed windows */
|
2017-08-26 12:26:30 -04:00
|
|
|
XSelectInput (window->display->x11_display->xdisplay,
|
2007-03-31 01:19:41 -04:00
|
|
|
window->user_time_window,
|
|
|
|
NoEventMask);
|
|
|
|
}
|
|
|
|
|
2016-11-11 14:29:59 -05:00
|
|
|
/* Ensure the new user time window is not used on another MetaWindow,
|
|
|
|
* and unset its user time window if that is the case.
|
|
|
|
*/
|
2017-08-26 12:56:44 -04:00
|
|
|
prev_owner = meta_x11_display_lookup_x_window (window->display->x11_display,
|
|
|
|
value->v.xwindow);
|
2016-11-11 14:29:59 -05:00
|
|
|
if (prev_owner && prev_owner->user_time_window == value->v.xwindow)
|
|
|
|
{
|
2017-08-26 12:56:44 -04:00
|
|
|
meta_x11_display_unregister_x_window (window->display->x11_display,
|
|
|
|
value->v.xwindow);
|
2016-11-11 14:29:59 -05:00
|
|
|
prev_owner->user_time_window = None;
|
|
|
|
}
|
2007-03-31 01:19:41 -04:00
|
|
|
|
|
|
|
/* Obtain the new NET_WM_USER_TIME_WINDOW and register it */
|
|
|
|
window->user_time_window = value->v.xwindow;
|
|
|
|
if (window->user_time_window != None)
|
|
|
|
{
|
|
|
|
/* Kind of a hack; display.c:event_callback() ignores events
|
|
|
|
* for unknown windows. We make window->user_time_window
|
|
|
|
* known by registering it with window (despite the fact
|
|
|
|
* that window->xwindow is already registered with window).
|
|
|
|
* This basically means that property notifies to either the
|
|
|
|
* window->user_time_window or window->xwindow will be
|
|
|
|
* treated identically and will result in functions for
|
|
|
|
* window being called to update it. Maybe we should ignore
|
|
|
|
* any property notifies to window->user_time_window other
|
2008-05-02 14:49:01 -04:00
|
|
|
* than atom__NET_WM_USER_TIME ones, but I just don't care
|
2007-03-31 01:19:41 -04:00
|
|
|
* and it's not specified in the spec anyway.
|
|
|
|
*/
|
2017-08-26 12:56:44 -04:00
|
|
|
meta_x11_display_register_x_window (window->display->x11_display,
|
|
|
|
&window->user_time_window,
|
|
|
|
window);
|
2007-03-31 01:19:41 -04:00
|
|
|
/* Just listen for property notify events */
|
2017-08-26 12:26:30 -04:00
|
|
|
XSelectInput (window->display->x11_display->xdisplay,
|
2007-03-31 01:19:41 -04:00
|
|
|
window->user_time_window,
|
|
|
|
PropertyChangeMask);
|
|
|
|
|
|
|
|
/* Manually load the _NET_WM_USER_TIME field from the given window
|
|
|
|
* at this time as well. If the user_time_window ever broadens in
|
|
|
|
* scope, we'll probably want to load all relevant properties here.
|
|
|
|
*/
|
|
|
|
meta_window_reload_property_from_xwindow (
|
|
|
|
window,
|
2007-11-09 13:57:29 -05:00
|
|
|
window->user_time_window,
|
2017-08-26 12:26:30 -04:00
|
|
|
window->display->x11_display->atom__NET_WM_USER_TIME,
|
2009-01-26 22:53:07 -05:00
|
|
|
initial);
|
2007-03-31 01:19:41 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-10-03 14:13:45 -04:00
|
|
|
#define MAX_TITLE_LENGTH 512
|
|
|
|
|
2005-11-23 12:08:03 -05:00
|
|
|
/**
|
2011-11-02 11:34:45 -04:00
|
|
|
* set_title_text:
|
|
|
|
*
|
2014-03-18 21:48:52 -04:00
|
|
|
* Called by set_window_title() to set the value of @target to @title.
|
|
|
|
* If required and @atom is set, it will update the appropriate property.
|
2005-11-23 12:08:03 -05:00
|
|
|
*
|
2011-11-02 11:34:45 -04:00
|
|
|
* Returns: %TRUE if a new title was set.
|
2005-11-23 12:08:03 -05:00
|
|
|
*/
|
|
|
|
static gboolean
|
2006-05-04 21:10:20 -04:00
|
|
|
set_title_text (MetaWindow *window,
|
|
|
|
gboolean previous_was_modified,
|
|
|
|
const char *title,
|
|
|
|
Atom atom,
|
|
|
|
char **target)
|
2002-11-03 19:19:08 -05:00
|
|
|
{
|
2005-11-23 12:08:03 -05:00
|
|
|
gboolean modified = FALSE;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2005-11-23 12:08:03 -05:00
|
|
|
if (!target)
|
|
|
|
return FALSE;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2005-11-23 12:08:03 -05:00
|
|
|
g_free (*target);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2005-11-23 12:08:03 -05:00
|
|
|
if (!title)
|
|
|
|
*target = g_strdup ("");
|
|
|
|
else if (g_utf8_strlen (title, MAX_TITLE_LENGTH + 1) > MAX_TITLE_LENGTH)
|
2005-10-03 14:13:45 -04:00
|
|
|
{
|
2005-11-23 12:08:03 -05:00
|
|
|
*target = meta_g_utf8_strndup (title, MAX_TITLE_LENGTH);
|
|
|
|
modified = TRUE;
|
|
|
|
}
|
|
|
|
/* if WM_CLIENT_MACHINE indicates this machine is on a remote host
|
|
|
|
* lets place that hostname in the title */
|
2013-02-20 15:19:31 -05:00
|
|
|
else if (meta_window_is_remote (window))
|
2005-11-23 12:08:03 -05:00
|
|
|
{
|
2006-03-12 16:04:56 -05:00
|
|
|
*target = g_strdup_printf (_("%s (on %s)"),
|
2005-11-23 12:08:03 -05:00
|
|
|
title, window->wm_client_machine);
|
|
|
|
modified = TRUE;
|
2005-10-03 14:13:45 -04:00
|
|
|
}
|
2005-11-23 12:08:03 -05:00
|
|
|
else
|
|
|
|
*target = g_strdup (title);
|
|
|
|
|
|
|
|
if (modified && atom != None)
|
2017-08-26 14:51:28 -04:00
|
|
|
meta_prop_set_utf8_string_hint (window->display->x11_display,
|
2006-05-04 21:10:20 -04:00
|
|
|
window->xwindow,
|
|
|
|
atom, *target);
|
|
|
|
|
|
|
|
/* Bug 330671 -- Don't forget to clear _NET_WM_VISIBLE_(ICON_)NAME */
|
|
|
|
if (!modified && previous_was_modified)
|
2006-10-01 17:36:10 -04:00
|
|
|
{
|
2017-08-27 14:48:55 -04:00
|
|
|
meta_x11_error_trap_push (window->display->x11_display);
|
2017-08-26 12:26:30 -04:00
|
|
|
XDeleteProperty (window->display->x11_display->xdisplay,
|
2006-10-01 17:36:10 -04:00
|
|
|
window->xwindow,
|
|
|
|
atom);
|
2017-08-27 14:48:55 -04:00
|
|
|
meta_x11_error_trap_pop (window->display->x11_display);
|
2006-10-01 17:36:10 -04:00
|
|
|
}
|
2005-11-23 12:08:03 -05:00
|
|
|
|
|
|
|
return modified;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_window_title (MetaWindow *window,
|
|
|
|
const char *title)
|
|
|
|
{
|
2014-03-18 13:07:50 -04:00
|
|
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
2019-08-20 15:38:35 -04:00
|
|
|
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
2014-03-18 13:07:50 -04:00
|
|
|
|
2013-08-30 03:40:36 -04:00
|
|
|
char *new_title = NULL;
|
2014-03-18 13:07:50 -04:00
|
|
|
|
2006-05-04 21:10:20 -04:00
|
|
|
gboolean modified =
|
|
|
|
set_title_text (window,
|
2014-03-18 13:07:50 -04:00
|
|
|
priv->using_net_wm_visible_name,
|
2006-05-04 21:10:20 -04:00
|
|
|
title,
|
2017-08-26 12:26:30 -04:00
|
|
|
window->display->x11_display->atom__NET_WM_VISIBLE_NAME,
|
2013-08-30 03:40:36 -04:00
|
|
|
&new_title);
|
2014-03-18 13:07:50 -04:00
|
|
|
priv->using_net_wm_visible_name = modified;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2013-08-30 03:40:36 -04:00
|
|
|
meta_window_set_title (window, new_title);
|
|
|
|
|
|
|
|
g_free (new_title);
|
2002-11-03 19:19:08 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reload_net_wm_name (MetaWindow *window,
|
2009-01-26 22:53:07 -05:00
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
2002-11-03 19:19:08 -05:00
|
|
|
{
|
2014-03-18 13:07:50 -04:00
|
|
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
2019-08-20 15:38:35 -04:00
|
|
|
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
2014-03-18 13:07:50 -04:00
|
|
|
|
2002-11-03 19:19:08 -05:00
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
|
|
|
{
|
|
|
|
set_window_title (window, value->v.str);
|
2014-03-18 13:07:50 -04:00
|
|
|
priv->using_net_wm_name = TRUE;
|
2002-11-03 19:19:08 -05:00
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Using _NET_WM_NAME for new title of %s: \"%s\"",
|
2002-11-03 19:19:08 -05:00
|
|
|
window->desc, window->title);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
set_window_title (window, NULL);
|
2014-03-18 13:07:50 -04:00
|
|
|
priv->using_net_wm_name = FALSE;
|
2009-01-26 22:53:07 -05:00
|
|
|
if (!initial)
|
|
|
|
meta_window_reload_property (window, XA_WM_NAME, FALSE);
|
2002-11-03 19:19:08 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reload_wm_name (MetaWindow *window,
|
2009-01-26 22:53:07 -05:00
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
2002-11-03 19:19:08 -05:00
|
|
|
{
|
2014-03-18 13:07:50 -04:00
|
|
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
2019-08-20 15:38:35 -04:00
|
|
|
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
2014-03-18 13:07:50 -04:00
|
|
|
|
|
|
|
if (priv->using_net_wm_name)
|
2002-11-03 19:19:08 -05:00
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Ignoring WM_NAME \"%s\" as _NET_WM_NAME is set",
|
2002-11-03 19:19:08 -05:00
|
|
|
value->v.str);
|
|
|
|
return;
|
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-11-03 19:19:08 -05:00
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
|
|
|
{
|
2018-10-08 18:40:33 -04:00
|
|
|
set_window_title (window, value->v.str);
|
2002-11-03 19:19:08 -05:00
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Using WM_NAME for new title of %s: \"%s\"",
|
2002-11-03 19:19:08 -05:00
|
|
|
window->desc, window->title);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
set_window_title (window, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-13 22:51:25 -04:00
|
|
|
static void
|
|
|
|
meta_window_set_opaque_region (MetaWindow *window,
|
|
|
|
cairo_region_t *region)
|
|
|
|
{
|
|
|
|
if (cairo_region_equal (window->opaque_region, region))
|
|
|
|
return;
|
|
|
|
|
|
|
|
g_clear_pointer (&window->opaque_region, cairo_region_destroy);
|
|
|
|
|
|
|
|
if (region != NULL)
|
|
|
|
window->opaque_region = cairo_region_reference (region);
|
|
|
|
|
|
|
|
meta_compositor_window_shape_changed (window->display->compositor, window);
|
|
|
|
}
|
|
|
|
|
2013-01-14 20:45:31 -05:00
|
|
|
static void
|
|
|
|
reload_opaque_region (MetaWindow *window,
|
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
|
|
|
{
|
2014-07-13 22:51:25 -04:00
|
|
|
cairo_region_t *opaque_region = NULL;
|
|
|
|
|
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
|
|
|
{
|
2015-06-23 18:09:07 -04:00
|
|
|
uint32_t *region = value->v.cardinal_list.cardinals;
|
2014-07-13 22:51:25 -04:00
|
|
|
int nitems = value->v.cardinal_list.n_cardinals;
|
|
|
|
|
|
|
|
cairo_rectangle_int_t *rects;
|
|
|
|
int i, rect_index, nrects;
|
|
|
|
|
|
|
|
if (nitems % 4 != 0)
|
|
|
|
{
|
|
|
|
meta_verbose ("_NET_WM_OPAQUE_REGION does not have a list of 4-tuples.");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* empty region */
|
|
|
|
if (nitems == 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
nrects = nitems / 4;
|
|
|
|
|
|
|
|
rects = g_new (cairo_rectangle_int_t, nrects);
|
|
|
|
|
|
|
|
rect_index = 0;
|
|
|
|
i = 0;
|
|
|
|
while (i < nitems)
|
|
|
|
{
|
|
|
|
cairo_rectangle_int_t *rect = &rects[rect_index];
|
|
|
|
|
|
|
|
rect->x = region[i++];
|
|
|
|
rect->y = region[i++];
|
|
|
|
rect->width = region[i++];
|
|
|
|
rect->height = region[i++];
|
|
|
|
|
|
|
|
rect_index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
opaque_region = cairo_region_create_rectangles (rects, nrects);
|
|
|
|
|
|
|
|
g_free (rects);
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
meta_window_set_opaque_region (window, opaque_region);
|
|
|
|
cairo_region_destroy (opaque_region);
|
2013-01-14 20:45:31 -05:00
|
|
|
}
|
|
|
|
|
2010-01-18 05:12:17 -05:00
|
|
|
static void
|
|
|
|
reload_mutter_hints (MetaWindow *window,
|
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
|
|
|
{
|
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
|
|
|
{
|
|
|
|
char *new_hints = value->v.str;
|
|
|
|
char *old_hints = window->mutter_hints;
|
|
|
|
gboolean changed = FALSE;
|
|
|
|
|
|
|
|
if (new_hints)
|
|
|
|
{
|
|
|
|
if (!old_hints || strcmp (new_hints, old_hints))
|
|
|
|
changed = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (old_hints)
|
|
|
|
changed = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (changed)
|
|
|
|
{
|
|
|
|
g_free (old_hints);
|
|
|
|
|
|
|
|
if (new_hints)
|
|
|
|
window->mutter_hints = g_strdup (new_hints);
|
|
|
|
else
|
|
|
|
window->mutter_hints = NULL;
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (window), "mutter-hints");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (window->mutter_hints)
|
|
|
|
{
|
|
|
|
g_free (window->mutter_hints);
|
|
|
|
window->mutter_hints = NULL;
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (window), "mutter-hints");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
static void
|
|
|
|
reload_net_wm_state (MetaWindow *window,
|
2009-01-26 22:53:07 -05:00
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
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
|
|
|
{
|
2017-08-26 12:26:30 -04:00
|
|
|
MetaX11Display *x11_display = window->display->x11_display;
|
2014-03-18 11:20:22 -04:00
|
|
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
2019-08-20 15:38:35 -04:00
|
|
|
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
2014-03-18 11:20:22 -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
|
|
|
int i;
|
|
|
|
|
|
|
|
/* We know this is only an initial window creation,
|
|
|
|
* clients don't change the property.
|
|
|
|
*/
|
|
|
|
|
2009-01-27 00:03:06 -05:00
|
|
|
if (!initial) {
|
|
|
|
/* no, they DON'T change the property */
|
|
|
|
meta_verbose ("Ignoring _NET_WM_STATE: we should be the one who set "
|
2020-10-02 11:47:22 -04:00
|
|
|
"the property in the first place");
|
2009-01-27 00:03:06 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
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->shaded = FALSE;
|
|
|
|
window->maximized_horizontally = FALSE;
|
|
|
|
window->maximized_vertically = FALSE;
|
2010-01-20 10:59:07 -05:00
|
|
|
window->fullscreen = FALSE;
|
2014-03-18 13:07:50 -04:00
|
|
|
priv->wm_state_modal = FALSE;
|
2014-03-18 11:20:22 -04:00
|
|
|
priv->wm_state_skip_taskbar = FALSE;
|
|
|
|
priv->wm_state_skip_pager = FALSE;
|
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->wm_state_above = FALSE;
|
|
|
|
window->wm_state_below = FALSE;
|
|
|
|
window->wm_state_demands_attention = FALSE;
|
|
|
|
|
|
|
|
if (value->type == META_PROP_VALUE_INVALID)
|
|
|
|
return;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < value->v.atom_list.n_atoms)
|
|
|
|
{
|
2017-08-26 12:26:30 -04:00
|
|
|
if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_SHADED)
|
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->shaded = TRUE;
|
2017-08-26 12:26:30 -04:00
|
|
|
else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_MAXIMIZED_HORZ)
|
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->maximize_horizontally_after_placement = TRUE;
|
2017-08-26 12:26:30 -04:00
|
|
|
else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_MAXIMIZED_VERT)
|
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->maximize_vertically_after_placement = TRUE;
|
2017-08-26 12:26:30 -04:00
|
|
|
else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_HIDDEN)
|
2006-10-01 17:59:09 -04:00
|
|
|
window->minimize_after_placement = TRUE;
|
2017-08-26 12:26:30 -04:00
|
|
|
else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_MODAL)
|
2014-03-18 13:07:50 -04:00
|
|
|
priv->wm_state_modal = TRUE;
|
2017-08-26 12:26:30 -04:00
|
|
|
else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_SKIP_TASKBAR)
|
2014-03-18 11:20:22 -04:00
|
|
|
priv->wm_state_skip_taskbar = TRUE;
|
2017-08-26 12:26:30 -04:00
|
|
|
else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_SKIP_PAGER)
|
2014-03-18 11:20:22 -04:00
|
|
|
priv->wm_state_skip_pager = TRUE;
|
2017-08-26 12:26:30 -04:00
|
|
|
else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_FULLSCREEN)
|
2015-07-29 13:02:48 -04:00
|
|
|
{
|
|
|
|
window->fullscreen = TRUE;
|
|
|
|
g_object_notify (G_OBJECT (window), "fullscreen");
|
|
|
|
}
|
2017-08-26 12:26:30 -04:00
|
|
|
else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_ABOVE)
|
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->wm_state_above = TRUE;
|
2017-08-26 12:26:30 -04:00
|
|
|
else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_BELOW)
|
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->wm_state_below = TRUE;
|
2017-08-26 12:26:30 -04:00
|
|
|
else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_DEMANDS_ATTENTION)
|
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->wm_state_demands_attention = TRUE;
|
2017-08-26 12:26:30 -04:00
|
|
|
else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_STICKY)
|
2011-02-28 05:41:23 -05:00
|
|
|
window->on_all_workspaces_requested = TRUE;
|
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
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Reloaded _NET_WM_STATE for %s",
|
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->desc);
|
|
|
|
|
2014-03-13 16:49:17 -04:00
|
|
|
meta_window_x11_recalc_window_type (window);
|
Fix initial setting of _NET_WM_STATE on new windows
When reload_net_wm_state() is called at startup to read the initial
value of _NET_WM_STATE, it was calling recalc_window_type(), but not
recalc_features(), which meant that, eg, meta->skip_taskbar would
never get initialized from meta->wm_state_skip_taskbar, which meant
that next time mutter went to update the window's _NET_WM_STATE, it
would overwrite the app-specified initial values. Fix that.
(In metacity, this bug is masked by the fact that recalc_features()
gets called when reading the intial value of WM_NORMAL_HINTS, which
comes after _NET_WM_STATE in metacity's prop_hooks_table. In mutter,
the table got reordered at some point, exposing the bug.)
https://bugzilla.gnome.org/show_bug.cgi?id=624360
2011-03-09 08:43:14 -05:00
|
|
|
meta_window_recalc_features (window);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reload_mwm_hints (MetaWindow *window,
|
2009-01-26 22:53:07 -05:00
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
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
|
|
|
{
|
|
|
|
MotifWmHints *hints;
|
2009-02-11 07:16:41 -05:00
|
|
|
gboolean old_decorated = window->decorated;
|
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->mwm_decorated = TRUE;
|
|
|
|
window->mwm_border_only = FALSE;
|
|
|
|
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;
|
|
|
|
|
|
|
|
if (value->type == META_PROP_VALUE_INVALID)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Window %s has no MWM hints", window->desc);
|
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
|
|
|
meta_window_recalc_features (window);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
hints = value->v.motif_hints;
|
|
|
|
|
|
|
|
/* We support those MWM hints deemed non-stupid */
|
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Window %s has MWM hints",
|
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->desc);
|
|
|
|
|
|
|
|
if (hints->flags & MWM_HINTS_DECORATIONS)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Window %s sets MWM_HINTS_DECORATIONS 0x%x",
|
|
|
|
window->desc, hints->decorations);
|
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
|
|
|
|
|
|
|
if (hints->decorations == 0)
|
|
|
|
window->mwm_decorated = FALSE;
|
|
|
|
/* some input methods use this */
|
|
|
|
else if (hints->decorations == MWM_DECOR_BORDER)
|
|
|
|
window->mwm_border_only = TRUE;
|
|
|
|
}
|
|
|
|
else
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Decorations flag unset");
|
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
|
|
|
|
|
|
|
if (hints->flags & MWM_HINTS_FUNCTIONS)
|
|
|
|
{
|
|
|
|
gboolean toggle_value;
|
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Window %s sets MWM_HINTS_FUNCTIONS 0x%x",
|
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->desc, hints->functions);
|
|
|
|
|
|
|
|
/* If _ALL is specified, then other flags indicate what to turn off;
|
|
|
|
* if ALL is not specified, flags are what to turn on.
|
|
|
|
* at least, I think so
|
|
|
|
*/
|
|
|
|
|
|
|
|
if ((hints->functions & MWM_FUNC_ALL) == 0)
|
|
|
|
{
|
|
|
|
toggle_value = TRUE;
|
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Window %s disables all funcs then reenables some",
|
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->desc);
|
|
|
|
window->mwm_has_close_func = FALSE;
|
|
|
|
window->mwm_has_minimize_func = FALSE;
|
|
|
|
window->mwm_has_maximize_func = FALSE;
|
|
|
|
window->mwm_has_move_func = FALSE;
|
|
|
|
window->mwm_has_resize_func = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Window %s enables all funcs then disables some",
|
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->desc);
|
|
|
|
toggle_value = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((hints->functions & MWM_FUNC_CLOSE) != 0)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Window %s toggles close via MWM hints",
|
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->desc);
|
|
|
|
window->mwm_has_close_func = toggle_value;
|
|
|
|
}
|
|
|
|
if ((hints->functions & MWM_FUNC_MINIMIZE) != 0)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Window %s toggles minimize via MWM hints",
|
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->desc);
|
|
|
|
window->mwm_has_minimize_func = toggle_value;
|
|
|
|
}
|
|
|
|
if ((hints->functions & MWM_FUNC_MAXIMIZE) != 0)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Window %s toggles maximize via MWM hints",
|
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->desc);
|
|
|
|
window->mwm_has_maximize_func = toggle_value;
|
|
|
|
}
|
|
|
|
if ((hints->functions & MWM_FUNC_MOVE) != 0)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Window %s toggles move via MWM hints",
|
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->desc);
|
|
|
|
window->mwm_has_move_func = toggle_value;
|
|
|
|
}
|
|
|
|
if ((hints->functions & MWM_FUNC_RESIZE) != 0)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Window %s toggles resize via MWM hints",
|
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->desc);
|
|
|
|
window->mwm_has_resize_func = toggle_value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2020-10-02 11:47:22 -04:00
|
|
|
{
|
|
|
|
meta_verbose ("Functions flag unset");
|
|
|
|
}
|
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
|
|
|
|
|
|
|
meta_window_recalc_features (window);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-02-01 19:19:22 -05:00
|
|
|
/* We do all this anyhow at the end of meta_window_x11_new() */
|
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
|
|
|
if (!window->constructing)
|
|
|
|
{
|
|
|
|
if (window->decorated)
|
|
|
|
meta_window_ensure_frame (window);
|
|
|
|
else
|
|
|
|
meta_window_destroy_frame (window);
|
2014-05-02 09:34:02 -04: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_MOVE_RESIZE |
|
|
|
|
/* because ensure/destroy frame may unmap: */
|
|
|
|
META_QUEUE_CALC_SHOWING);
|
2009-02-11 07:16:41 -05:00
|
|
|
|
|
|
|
if (old_decorated != window->decorated)
|
|
|
|
g_object_notify (G_OBJECT (window), "decorated");
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reload_wm_class (MetaWindow *window,
|
2009-01-26 22:53:07 -05:00
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
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
|
|
|
{
|
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
2013-08-30 03:40:36 -04:00
|
|
|
{
|
2016-03-22 15:30:43 -04:00
|
|
|
g_autofree gchar *res_class = g_convert (value->v.class_hint.res_class, -1,
|
|
|
|
"UTF-8", "LATIN1",
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
g_autofree gchar *res_name = g_convert (value->v.class_hint.res_name, -1,
|
|
|
|
"UTF-8", "LATIN1",
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
meta_window_set_wm_class (window, res_class, res_name);
|
2013-08-30 03:40:36 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_window_set_wm_class (window, NULL, NULL);
|
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
|
|
|
}
|
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Window %s class: '%s' name: '%s'",
|
|
|
|
window->desc,
|
|
|
|
window->res_class ? window->res_class : "none",
|
|
|
|
window->res_name ? window->res_name : "none");
|
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
|
|
|
}
|
|
|
|
|
2002-11-21 00:02:38 -05:00
|
|
|
static void
|
|
|
|
reload_net_wm_desktop (MetaWindow *window,
|
2009-01-26 22:53:07 -05:00
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
2002-11-21 00:02:38 -05:00
|
|
|
{
|
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
|
|
|
{
|
|
|
|
window->initial_workspace_set = TRUE;
|
|
|
|
window->initial_workspace = value->v.cardinal;
|
|
|
|
meta_topic (META_DEBUG_PLACEMENT,
|
2020-10-02 11:47:22 -04:00
|
|
|
"Read initial workspace prop %d for %s",
|
2002-11-21 00:02:38 -05:00
|
|
|
window->initial_workspace, window->desc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-30 22:58:04 -05:00
|
|
|
static void
|
|
|
|
reload_net_startup_id (MetaWindow *window,
|
2009-01-26 22:53:07 -05:00
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
2002-11-30 22:58:04 -05:00
|
|
|
{
|
2017-08-27 15:02:40 -04:00
|
|
|
MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
|
2006-08-07 14:08:27 -04:00
|
|
|
guint32 timestamp = window->net_wm_user_time;
|
|
|
|
MetaWorkspace *workspace = NULL;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-11-30 22:58:04 -05:00
|
|
|
g_free (window->startup_id);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-11-30 22:58:04 -05:00
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
|
|
|
window->startup_id = g_strdup (value->v.str);
|
|
|
|
else
|
|
|
|
window->startup_id = NULL;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2006-08-07 14:08:27 -04:00
|
|
|
/* Update timestamp and workspace on a running window */
|
|
|
|
if (!window->constructing)
|
|
|
|
{
|
2014-05-02 09:34:02 -04:00
|
|
|
window->initial_timestamp_set = 0;
|
2006-08-07 14:08:27 -04:00
|
|
|
window->initial_workspace_set = 0;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2017-08-26 15:10:38 -04:00
|
|
|
if (meta_display_apply_startup_properties (window->display, window))
|
2007-06-17 22:37:14 -04:00
|
|
|
{
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2007-06-17 22:37:14 -04:00
|
|
|
if (window->initial_timestamp_set)
|
|
|
|
timestamp = window->initial_timestamp;
|
|
|
|
if (window->initial_workspace_set)
|
2017-08-27 15:02:40 -04:00
|
|
|
workspace = meta_workspace_manager_get_workspace_by_index (workspace_manager,
|
|
|
|
window->initial_workspace);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2007-06-17 22:37:14 -04:00
|
|
|
meta_window_activate_with_workspace (window, timestamp, workspace);
|
|
|
|
}
|
2006-08-07 14:08:27 -04:00
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("New _NET_STARTUP_ID \"%s\" for %s",
|
2002-11-30 22:58:04 -05:00
|
|
|
window->startup_id ? window->startup_id : "unset",
|
|
|
|
window->desc);
|
|
|
|
}
|
|
|
|
|
2002-12-09 22:23:04 -05:00
|
|
|
static void
|
|
|
|
reload_update_counter (MetaWindow *window,
|
2009-01-26 22:53:07 -05:00
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
2002-12-09 22:23:04 -05:00
|
|
|
{
|
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
|
|
|
{
|
2014-04-29 16:59:54 -04:00
|
|
|
meta_window_x11_destroy_sync_request_alarm (window);
|
2011-06-08 13:58:54 -04:00
|
|
|
window->sync_request_counter = None;
|
2011-06-08 11:26:03 -04:00
|
|
|
|
2011-06-08 13:58:54 -04:00
|
|
|
if (value->v.xcounter_list.n_counters == 0)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_warning ("_NET_WM_SYNC_REQUEST_COUNTER is empty");
|
2011-06-08 13:58:54 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (value->v.xcounter_list.n_counters == 1)
|
|
|
|
{
|
|
|
|
window->sync_request_counter = value->v.xcounter_list.counters[0];
|
|
|
|
window->extended_sync_request_counter = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
window->sync_request_counter = value->v.xcounter_list.counters[1];
|
|
|
|
window->extended_sync_request_counter = TRUE;
|
|
|
|
}
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Window has _NET_WM_SYNC_REQUEST_COUNTER 0x%lx (extended=%s)",
|
2011-06-08 13:58:54 -04:00
|
|
|
window->sync_request_counter,
|
|
|
|
window->extended_sync_request_counter ? "true" : "false");
|
2002-12-09 22:23:04 -05:00
|
|
|
|
2011-06-08 13:58:54 -04:00
|
|
|
if (window->extended_sync_request_counter)
|
2014-04-29 16:59:54 -04:00
|
|
|
meta_window_x11_create_sync_request_alarm (window);
|
2002-12-09 22:23:04 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-16 10:50:24 -05:00
|
|
|
#define FLAG_IS_ON(hints,flag) \
|
|
|
|
(((hints)->flags & (flag)) != 0)
|
|
|
|
|
|
|
|
#define FLAG_IS_OFF(hints,flag) \
|
|
|
|
(((hints)->flags & (flag)) == 0)
|
|
|
|
|
2003-02-27 20:24:44 -05:00
|
|
|
#define FLAG_TOGGLED_ON(old,new,flag) \
|
2020-11-16 10:50:24 -05:00
|
|
|
(FLAG_IS_OFF(old,flag) && \
|
|
|
|
FLAG_IS_ON(new,flag))
|
2003-02-27 20:24:44 -05:00
|
|
|
|
|
|
|
#define FLAG_TOGGLED_OFF(old,new,flag) \
|
2020-11-16 10:50:24 -05:00
|
|
|
(FLAG_IS_ON(old,flag) && \
|
|
|
|
FLAG_IS_OFF(new,flag))
|
2003-02-27 20:24:44 -05:00
|
|
|
|
|
|
|
#define FLAG_CHANGED(old,new,flag) \
|
|
|
|
(FLAG_TOGGLED_ON(old,new,flag) || FLAG_TOGGLED_OFF(old,new,flag))
|
|
|
|
|
|
|
|
static void
|
|
|
|
spew_size_hints_differences (const XSizeHints *old,
|
|
|
|
const XSizeHints *new)
|
|
|
|
{
|
|
|
|
if (FLAG_CHANGED (old, new, USPosition))
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: USPosition now %s",
|
2003-02-27 20:24:44 -05:00
|
|
|
FLAG_TOGGLED_ON (old, new, USPosition) ? "set" : "unset");
|
|
|
|
if (FLAG_CHANGED (old, new, USSize))
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: USSize now %s",
|
2003-02-27 20:24:44 -05:00
|
|
|
FLAG_TOGGLED_ON (old, new, USSize) ? "set" : "unset");
|
|
|
|
if (FLAG_CHANGED (old, new, PPosition))
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PPosition now %s",
|
2003-02-27 20:24:44 -05:00
|
|
|
FLAG_TOGGLED_ON (old, new, PPosition) ? "set" : "unset");
|
|
|
|
if (FLAG_CHANGED (old, new, PSize))
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PSize now %s",
|
2003-02-27 20:24:44 -05:00
|
|
|
FLAG_TOGGLED_ON (old, new, PSize) ? "set" : "unset");
|
|
|
|
if (FLAG_CHANGED (old, new, PMinSize))
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PMinSize now %s (%d x %d -> %d x %d)",
|
2003-02-27 20:24:44 -05:00
|
|
|
FLAG_TOGGLED_ON (old, new, PMinSize) ? "set" : "unset",
|
|
|
|
old->min_width, old->min_height,
|
|
|
|
new->min_width, new->min_height);
|
|
|
|
if (FLAG_CHANGED (old, new, PMaxSize))
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PMaxSize now %s (%d x %d -> %d x %d)",
|
2003-02-27 20:24:44 -05:00
|
|
|
FLAG_TOGGLED_ON (old, new, PMaxSize) ? "set" : "unset",
|
|
|
|
old->max_width, old->max_height,
|
|
|
|
new->max_width, new->max_height);
|
|
|
|
if (FLAG_CHANGED (old, new, PResizeInc))
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PResizeInc now %s (width_inc %d -> %d height_inc %d -> %d)",
|
2003-02-27 20:24:44 -05:00
|
|
|
FLAG_TOGGLED_ON (old, new, PResizeInc) ? "set" : "unset",
|
|
|
|
old->width_inc, new->width_inc,
|
|
|
|
old->height_inc, new->height_inc);
|
|
|
|
if (FLAG_CHANGED (old, new, PAspect))
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PAspect now %s (min %d/%d -> %d/%d max %d/%d -> %d/%d)",
|
2003-02-27 20:24:44 -05:00
|
|
|
FLAG_TOGGLED_ON (old, new, PAspect) ? "set" : "unset",
|
|
|
|
old->min_aspect.x, old->min_aspect.y,
|
|
|
|
new->min_aspect.x, new->min_aspect.y,
|
|
|
|
old->max_aspect.x, old->max_aspect.y,
|
|
|
|
new->max_aspect.x, new->max_aspect.y);
|
|
|
|
if (FLAG_CHANGED (old, new, PBaseSize))
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PBaseSize now %s (%d x %d -> %d x %d)",
|
2003-02-27 20:24:44 -05:00
|
|
|
FLAG_TOGGLED_ON (old, new, PBaseSize) ? "set" : "unset",
|
|
|
|
old->base_width, old->base_height,
|
|
|
|
new->base_width, new->base_height);
|
|
|
|
if (FLAG_CHANGED (old, new, PWinGravity))
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PWinGravity now %s (%d -> %d)",
|
2003-02-27 20:24:44 -05:00
|
|
|
FLAG_TOGGLED_ON (old, new, PWinGravity) ? "set" : "unset",
|
2014-05-02 09:34:02 -04:00
|
|
|
old->win_gravity, new->win_gravity);
|
2003-02-27 20:24:44 -05:00
|
|
|
}
|
|
|
|
|
window-props: Check for actual size hints changes
The XSizeHints set by X11 clients give a hint to the window manager
about size increment, aspect ratio, base, minimum and maximum size, etc.
When an X11 client changes those values, there is a good chance that it
will affect the actual window size in some way, and mutter rightfully
queue a window resize in that case.
However, mutter does not check if any of the hints have actually changed
and unconditionally queue a window resize whenever a client changes its
WM_NORMAL_HINTS property.
That can be a problem when a zealous client such as xterm decides to
update its WM_NORMAL_HINTS property on resize, because in return mutter
will queue a non-user driven resize in the middle of user-driven events,
hence defeating the purpose of the META_MOVE_RESIZE_USER_ACTION flag.
To avoid that issue, make mutter a bit smarter and avoid queuing a
window resize if the XSizeHints haven't actually changed.
https://gitlab.gnome.org/GNOME/mutter/-/issues/543
2020-10-15 08:23:41 -04:00
|
|
|
static gboolean
|
|
|
|
hints_have_changed (const XSizeHints *old,
|
|
|
|
const XSizeHints *new)
|
|
|
|
{
|
2020-11-16 10:50:24 -05:00
|
|
|
/* 1. Check if the relevant values have changed if the flag is set. */
|
|
|
|
|
|
|
|
if (FLAG_TOGGLED_ON (old, new, USPosition) ||
|
|
|
|
(FLAG_IS_ON (new, USPosition) &&
|
|
|
|
(old->x != new->x ||
|
|
|
|
old->y != new->y)))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (FLAG_TOGGLED_ON (old, new, USSize) ||
|
|
|
|
(FLAG_IS_ON (new, USSize) &&
|
|
|
|
(old->width != new->width ||
|
|
|
|
old->height != new->height)))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (FLAG_TOGGLED_ON (old, new, PPosition) ||
|
|
|
|
(FLAG_IS_ON (new, PPosition) &&
|
|
|
|
(old->x != new->x ||
|
|
|
|
old->y != new->y)))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (FLAG_TOGGLED_ON (old, new, PSize) ||
|
|
|
|
(FLAG_IS_ON (new, PSize) &&
|
|
|
|
(old->width != new->width ||
|
|
|
|
old->height != new->height)))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (FLAG_TOGGLED_ON (old, new, PMinSize) ||
|
|
|
|
(FLAG_IS_ON (new, PMinSize) &&
|
|
|
|
(old->min_width != new->min_width ||
|
|
|
|
old->min_height != new->min_height)))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (FLAG_TOGGLED_ON (old, new, PMaxSize) ||
|
|
|
|
(FLAG_IS_ON (new, PMaxSize) &&
|
|
|
|
(old->max_width != new->max_width ||
|
|
|
|
old->max_height != new->max_height)))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (FLAG_TOGGLED_ON (old, new, PResizeInc) ||
|
|
|
|
(FLAG_IS_ON (new, PResizeInc) &&
|
|
|
|
(old->width_inc != new->width_inc ||
|
|
|
|
old->height_inc != new->height_inc)))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (FLAG_TOGGLED_ON (old, new, PAspect) ||
|
|
|
|
(FLAG_IS_ON (new, PAspect) &&
|
|
|
|
(old->min_aspect.x != new->min_aspect.x ||
|
|
|
|
old->min_aspect.y != new->min_aspect.y ||
|
|
|
|
old->max_aspect.x != new->max_aspect.x ||
|
|
|
|
old->max_aspect.y != new->max_aspect.y)))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (FLAG_TOGGLED_ON (old, new, PBaseSize) ||
|
|
|
|
(FLAG_IS_ON (new, PBaseSize) &&
|
|
|
|
(old->base_width != new->base_width ||
|
|
|
|
old->base_height != new->base_height)))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (FLAG_TOGGLED_ON (old, new, PWinGravity) ||
|
|
|
|
(FLAG_IS_ON (new, PWinGravity) &&
|
|
|
|
(old->win_gravity != new->win_gravity)))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* 2. Check if the flags have been unset. */
|
|
|
|
return FLAG_TOGGLED_OFF (old, new, USPosition) ||
|
|
|
|
FLAG_TOGGLED_OFF (old, new, USSize) ||
|
|
|
|
FLAG_TOGGLED_OFF (old, new, PPosition) ||
|
|
|
|
FLAG_TOGGLED_OFF (old, new, PSize) ||
|
|
|
|
FLAG_TOGGLED_OFF (old, new, PMinSize) ||
|
|
|
|
FLAG_TOGGLED_OFF (old, new, PMaxSize) ||
|
|
|
|
FLAG_TOGGLED_OFF (old, new, PResizeInc) ||
|
|
|
|
FLAG_TOGGLED_OFF (old, new, PAspect) ||
|
|
|
|
FLAG_TOGGLED_OFF (old, new, PBaseSize) ||
|
|
|
|
FLAG_TOGGLED_OFF (old, new, PWinGravity);
|
window-props: Check for actual size hints changes
The XSizeHints set by X11 clients give a hint to the window manager
about size increment, aspect ratio, base, minimum and maximum size, etc.
When an X11 client changes those values, there is a good chance that it
will affect the actual window size in some way, and mutter rightfully
queue a window resize in that case.
However, mutter does not check if any of the hints have actually changed
and unconditionally queue a window resize whenever a client changes its
WM_NORMAL_HINTS property.
That can be a problem when a zealous client such as xterm decides to
update its WM_NORMAL_HINTS property on resize, because in return mutter
will queue a non-user driven resize in the middle of user-driven events,
hence defeating the purpose of the META_MOVE_RESIZE_USER_ACTION flag.
To avoid that issue, make mutter a bit smarter and avoid queuing a
window resize if the XSizeHints haven't actually changed.
https://gitlab.gnome.org/GNOME/mutter/-/issues/543
2020-10-15 08:23:41 -04:00
|
|
|
}
|
|
|
|
|
2003-04-26 13:40:32 -04:00
|
|
|
void
|
|
|
|
meta_set_normal_hints (MetaWindow *window,
|
2007-04-04 17:54:56 -04:00
|
|
|
XSizeHints *hints)
|
2003-04-26 13:40:32 -04:00
|
|
|
{
|
|
|
|
int x, y, w, h;
|
2007-04-04 17:54:56 -04:00
|
|
|
double minr, maxr;
|
|
|
|
/* Some convenience vars */
|
|
|
|
int minw, minh, maxw, maxh; /* min/max width/height */
|
|
|
|
int basew, baseh, winc, hinc; /* base width/height, width/height increment */
|
|
|
|
|
2003-04-26 13:40:32 -04:00
|
|
|
/* Save the last ConfigureRequest, which we put here.
|
|
|
|
* Values here set in the hints are supposed to
|
|
|
|
* be ignored.
|
|
|
|
*/
|
|
|
|
x = window->size_hints.x;
|
|
|
|
y = window->size_hints.y;
|
|
|
|
w = window->size_hints.width;
|
|
|
|
h = window->size_hints.height;
|
|
|
|
|
|
|
|
/* as far as I can tell, value->v.size_hints.flags is just to
|
|
|
|
* check whether we had old-style normal hints without gravity,
|
|
|
|
* base size as returned by XGetNormalHints(), so we don't
|
|
|
|
* really use it as we fixup window->size_hints to have those
|
|
|
|
* fields if they're missing.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* When the window is first created, NULL hints will
|
|
|
|
* be passed in which will initialize all of the fields
|
|
|
|
* as if flags were zero
|
|
|
|
*/
|
|
|
|
if (hints)
|
|
|
|
window->size_hints = *hints;
|
|
|
|
else
|
|
|
|
window->size_hints.flags = 0;
|
|
|
|
|
|
|
|
/* Put back saved ConfigureRequest. */
|
|
|
|
window->size_hints.x = x;
|
|
|
|
window->size_hints.y = y;
|
|
|
|
window->size_hints.width = w;
|
|
|
|
window->size_hints.height = h;
|
|
|
|
|
2007-04-04 17:54:56 -04:00
|
|
|
/* Get base size hints */
|
2003-04-26 13:40:32 -04:00
|
|
|
if (window->size_hints.flags & PBaseSize)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY, "Window %s sets base size %d x %d",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc,
|
|
|
|
window->size_hints.base_width,
|
|
|
|
window->size_hints.base_height);
|
2003-04-26 13:40:32 -04:00
|
|
|
}
|
|
|
|
else if (window->size_hints.flags & PMinSize)
|
|
|
|
{
|
|
|
|
window->size_hints.base_width = window->size_hints.min_width;
|
|
|
|
window->size_hints.base_height = window->size_hints.min_height;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
window->size_hints.base_width = 0;
|
|
|
|
window->size_hints.base_height = 0;
|
|
|
|
}
|
|
|
|
window->size_hints.flags |= PBaseSize;
|
|
|
|
|
2007-04-04 17:54:56 -04:00
|
|
|
/* Get min size hints */
|
2003-04-26 13:40:32 -04:00
|
|
|
if (window->size_hints.flags & PMinSize)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY, "Window %s sets min size %d x %d",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc,
|
|
|
|
window->size_hints.min_width,
|
|
|
|
window->size_hints.min_height);
|
2003-04-26 13:40:32 -04:00
|
|
|
}
|
|
|
|
else if (window->size_hints.flags & PBaseSize)
|
|
|
|
{
|
|
|
|
window->size_hints.min_width = window->size_hints.base_width;
|
|
|
|
window->size_hints.min_height = window->size_hints.base_height;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
window->size_hints.min_width = 0;
|
|
|
|
window->size_hints.min_height = 0;
|
|
|
|
}
|
|
|
|
window->size_hints.flags |= PMinSize;
|
|
|
|
|
2007-04-04 17:54:56 -04:00
|
|
|
/* Get max size hints */
|
2003-04-26 13:40:32 -04:00
|
|
|
if (window->size_hints.flags & PMaxSize)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY, "Window %s sets max size %d x %d",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc,
|
|
|
|
window->size_hints.max_width,
|
|
|
|
window->size_hints.max_height);
|
2003-04-26 13:40:32 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
window->size_hints.max_width = G_MAXINT;
|
|
|
|
window->size_hints.max_height = G_MAXINT;
|
|
|
|
window->size_hints.flags |= PMaxSize;
|
|
|
|
}
|
|
|
|
|
2007-04-04 17:54:56 -04:00
|
|
|
/* Get resize increment hints */
|
|
|
|
if (window->size_hints.flags & PResizeInc)
|
2003-04-26 13:40:32 -04:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_GEOMETRY,
|
2020-10-02 11:47:22 -04:00
|
|
|
"Window %s sets resize width inc: %d height inc: %d",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc,
|
|
|
|
window->size_hints.width_inc,
|
|
|
|
window->size_hints.height_inc);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
window->size_hints.width_inc = 1;
|
|
|
|
window->size_hints.height_inc = 1;
|
|
|
|
window->size_hints.flags |= PResizeInc;
|
2003-04-26 13:40:32 -04:00
|
|
|
}
|
|
|
|
|
2007-04-04 17:54:56 -04:00
|
|
|
/* Get aspect ratio hints */
|
|
|
|
if (window->size_hints.flags & PAspect)
|
2003-04-26 13:40:32 -04:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_GEOMETRY,
|
2020-10-02 11:47:22 -04:00
|
|
|
"Window %s sets min_aspect: %d/%d max_aspect: %d/%d",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc,
|
|
|
|
window->size_hints.min_aspect.x,
|
|
|
|
window->size_hints.min_aspect.y,
|
|
|
|
window->size_hints.max_aspect.x,
|
|
|
|
window->size_hints.max_aspect.y);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
window->size_hints.min_aspect.x = 1;
|
|
|
|
window->size_hints.min_aspect.y = G_MAXINT;
|
|
|
|
window->size_hints.max_aspect.x = G_MAXINT;
|
|
|
|
window->size_hints.max_aspect.y = 1;
|
|
|
|
window->size_hints.flags |= PAspect;
|
2003-04-26 13:40:32 -04:00
|
|
|
}
|
|
|
|
|
2007-04-04 17:54:56 -04:00
|
|
|
/* Get gravity hint */
|
|
|
|
if (window->size_hints.flags & PWinGravity)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY, "Window %s sets gravity %d",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc,
|
|
|
|
window->size_hints.win_gravity);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_GEOMETRY,
|
2020-10-02 11:47:22 -04:00
|
|
|
"Window %s doesn't set gravity, using NW",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc);
|
2020-02-14 03:44:43 -05:00
|
|
|
window->size_hints.win_gravity = META_GRAVITY_NORTH_WEST;
|
2007-04-04 17:54:56 -04:00
|
|
|
window->size_hints.flags |= PWinGravity;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** Lots of sanity checking ***/
|
|
|
|
|
|
|
|
/* Verify all min & max hints are at least 1 pixel */
|
2003-04-26 13:40:32 -04:00
|
|
|
if (window->size_hints.min_width < 1)
|
|
|
|
{
|
2007-04-04 17:54:56 -04:00
|
|
|
/* someone is on crack */
|
2003-04-26 13:40:32 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY,
|
2020-10-02 11:47:22 -04:00
|
|
|
"Window %s sets min width to 0, which makes no sense",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc);
|
2003-04-26 13:40:32 -04:00
|
|
|
window->size_hints.min_width = 1;
|
|
|
|
}
|
|
|
|
if (window->size_hints.max_width < 1)
|
|
|
|
{
|
|
|
|
/* another cracksmoker */
|
|
|
|
meta_topic (META_DEBUG_GEOMETRY,
|
2020-10-02 11:47:22 -04:00
|
|
|
"Window %s sets max width to 0, which makes no sense",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc);
|
2003-04-26 13:40:32 -04:00
|
|
|
window->size_hints.max_width = 1;
|
|
|
|
}
|
|
|
|
if (window->size_hints.min_height < 1)
|
|
|
|
{
|
|
|
|
/* another cracksmoker */
|
|
|
|
meta_topic (META_DEBUG_GEOMETRY,
|
2020-10-02 11:47:22 -04:00
|
|
|
"Window %s sets min height to 0, which makes no sense",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc);
|
2003-04-26 13:40:32 -04:00
|
|
|
window->size_hints.min_height = 1;
|
|
|
|
}
|
|
|
|
if (window->size_hints.max_height < 1)
|
|
|
|
{
|
|
|
|
/* another cracksmoker */
|
|
|
|
meta_topic (META_DEBUG_GEOMETRY,
|
2020-10-02 11:47:22 -04:00
|
|
|
"Window %s sets max height to 0, which makes no sense",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc);
|
2003-04-26 13:40:32 -04:00
|
|
|
window->size_hints.max_height = 1;
|
|
|
|
}
|
|
|
|
|
2007-04-04 17:54:56 -04:00
|
|
|
/* Verify size increment hints are at least 1 pixel */
|
|
|
|
if (window->size_hints.width_inc < 1)
|
2003-04-26 13:40:32 -04:00
|
|
|
{
|
2007-04-04 17:54:56 -04:00
|
|
|
/* app authors find so many ways to smoke crack */
|
|
|
|
window->size_hints.width_inc = 1;
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY, "Corrected 0 width_inc to 1");
|
2003-04-26 13:40:32 -04:00
|
|
|
}
|
2007-04-04 17:54:56 -04:00
|
|
|
if (window->size_hints.height_inc < 1)
|
2003-04-26 13:40:32 -04:00
|
|
|
{
|
2007-04-04 17:54:56 -04:00
|
|
|
/* another cracksmoker */
|
2003-04-26 13:40:32 -04:00
|
|
|
window->size_hints.height_inc = 1;
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY, "Corrected 0 height_inc to 1");
|
2007-04-04 17:54:56 -04:00
|
|
|
}
|
|
|
|
/* divide by 0 cracksmokers; note that x & y in (min|max)_aspect are
|
|
|
|
* numerator & denominator
|
|
|
|
*/
|
|
|
|
if (window->size_hints.min_aspect.y < 1)
|
|
|
|
window->size_hints.min_aspect.y = 1;
|
|
|
|
if (window->size_hints.max_aspect.y < 1)
|
|
|
|
window->size_hints.max_aspect.y = 1;
|
|
|
|
|
|
|
|
minw = window->size_hints.min_width; minh = window->size_hints.min_height;
|
|
|
|
maxw = window->size_hints.max_width; maxh = window->size_hints.max_height;
|
|
|
|
basew = window->size_hints.base_width; baseh = window->size_hints.base_height;
|
|
|
|
winc = window->size_hints.width_inc; hinc = window->size_hints.height_inc;
|
|
|
|
|
|
|
|
/* Make sure min and max size hints are consistent with the base + increment
|
|
|
|
* size hints. If they're not, it's not a real big deal, but it means the
|
|
|
|
* effective min and max size are more restrictive than the application
|
|
|
|
* specified values.
|
|
|
|
*/
|
|
|
|
if ((minw - basew) % winc != 0)
|
|
|
|
{
|
|
|
|
/* Take advantage of integer division throwing away the remainder... */
|
|
|
|
window->size_hints.min_width = basew + ((minw - basew)/winc + 1)*winc;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_GEOMETRY,
|
|
|
|
"Window %s has width_inc (%d) that does not evenly divide "
|
|
|
|
"min_width - base_width (%d - %d); thus effective "
|
2020-10-02 11:47:22 -04:00
|
|
|
"min_width is really %d",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc,
|
|
|
|
winc, minw, basew, window->size_hints.min_width);
|
|
|
|
minw = window->size_hints.min_width;
|
2003-04-26 13:40:32 -04:00
|
|
|
}
|
2007-04-04 17:54:56 -04:00
|
|
|
if (maxw != G_MAXINT && (maxw - basew) % winc != 0)
|
|
|
|
{
|
|
|
|
/* Take advantage of integer division throwing away the remainder... */
|
|
|
|
window->size_hints.max_width = basew + ((maxw - basew)/winc)*winc;
|
2003-04-26 13:40:32 -04:00
|
|
|
|
2007-04-04 17:54:56 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY,
|
|
|
|
"Window %s has width_inc (%d) that does not evenly divide "
|
|
|
|
"max_width - base_width (%d - %d); thus effective "
|
2020-10-02 11:47:22 -04:00
|
|
|
"max_width is really %d",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc,
|
|
|
|
winc, maxw, basew, window->size_hints.max_width);
|
|
|
|
maxw = window->size_hints.max_width;
|
|
|
|
}
|
|
|
|
if ((minh - baseh) % hinc != 0)
|
2003-04-26 13:40:32 -04:00
|
|
|
{
|
2007-04-04 17:54:56 -04:00
|
|
|
/* Take advantage of integer division throwing away the remainder... */
|
|
|
|
window->size_hints.min_height = baseh + ((minh - baseh)/hinc + 1)*hinc;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_GEOMETRY,
|
|
|
|
"Window %s has height_inc (%d) that does not evenly divide "
|
|
|
|
"min_height - base_height (%d - %d); thus effective "
|
2020-10-02 11:47:22 -04:00
|
|
|
"min_height is really %d",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc,
|
|
|
|
hinc, minh, baseh, window->size_hints.min_height);
|
|
|
|
minh = window->size_hints.min_height;
|
2003-04-26 13:40:32 -04:00
|
|
|
}
|
2007-04-04 17:54:56 -04:00
|
|
|
if (maxh != G_MAXINT && (maxh - baseh) % hinc != 0)
|
2003-04-26 13:40:32 -04:00
|
|
|
{
|
2007-04-04 17:54:56 -04:00
|
|
|
/* Take advantage of integer division throwing away the remainder... */
|
|
|
|
window->size_hints.max_height = baseh + ((maxh - baseh)/hinc)*hinc;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_GEOMETRY,
|
|
|
|
"Window %s has height_inc (%d) that does not evenly divide "
|
|
|
|
"max_height - base_height (%d - %d); thus effective "
|
2020-10-02 11:47:22 -04:00
|
|
|
"max_height is really %d",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc,
|
|
|
|
hinc, maxh, baseh, window->size_hints.max_height);
|
|
|
|
maxh = window->size_hints.max_height;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* make sure maximum size hints are compatible with minimum size hints; min
|
|
|
|
* size hints take precedence.
|
|
|
|
*/
|
|
|
|
if (window->size_hints.max_width < window->size_hints.min_width)
|
|
|
|
{
|
|
|
|
/* another cracksmoker */
|
|
|
|
meta_topic (META_DEBUG_GEOMETRY,
|
|
|
|
"Window %s sets max width %d less than min width %d, "
|
2020-10-02 11:47:22 -04:00
|
|
|
"disabling resize",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc,
|
|
|
|
window->size_hints.max_width,
|
|
|
|
window->size_hints.min_width);
|
|
|
|
maxw = window->size_hints.max_width = window->size_hints.min_width;
|
|
|
|
}
|
|
|
|
if (window->size_hints.max_height < window->size_hints.min_height)
|
|
|
|
{
|
|
|
|
/* another cracksmoker */
|
|
|
|
meta_topic (META_DEBUG_GEOMETRY,
|
|
|
|
"Window %s sets max height %d less than min height %d, "
|
2020-10-02 11:47:22 -04:00
|
|
|
"disabling resize",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc,
|
|
|
|
window->size_hints.max_height,
|
|
|
|
window->size_hints.min_height);
|
|
|
|
maxh = window->size_hints.max_height = window->size_hints.min_height;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Make sure the aspect ratio hints are sane. */
|
|
|
|
minr = window->size_hints.min_aspect.x /
|
|
|
|
(double)window->size_hints.min_aspect.y;
|
|
|
|
maxr = window->size_hints.max_aspect.x /
|
|
|
|
(double)window->size_hints.max_aspect.y;
|
|
|
|
if (minr > maxr)
|
|
|
|
{
|
|
|
|
/* another cracksmoker; not even minimally (self) consistent */
|
|
|
|
meta_topic (META_DEBUG_GEOMETRY,
|
|
|
|
"Window %s sets min aspect ratio larger than max aspect "
|
2020-10-02 11:47:22 -04:00
|
|
|
"ratio; disabling aspect ratio constraints.",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc);
|
2003-04-26 13:40:32 -04:00
|
|
|
window->size_hints.min_aspect.x = 1;
|
|
|
|
window->size_hints.min_aspect.y = G_MAXINT;
|
|
|
|
window->size_hints.max_aspect.x = G_MAXINT;
|
|
|
|
window->size_hints.max_aspect.y = 1;
|
|
|
|
}
|
2007-04-04 17:54:56 -04:00
|
|
|
else /* check consistency of aspect ratio hints with other hints */
|
2003-04-26 13:40:32 -04:00
|
|
|
{
|
2007-04-04 17:54:56 -04:00
|
|
|
if (minh > 0 && minr > (maxw / (double)minh))
|
|
|
|
{
|
|
|
|
/* another cracksmoker */
|
|
|
|
meta_topic (META_DEBUG_GEOMETRY,
|
|
|
|
"Window %s sets min aspect ratio larger than largest "
|
|
|
|
"aspect ratio possible given min/max size constraints; "
|
2020-10-02 11:47:22 -04:00
|
|
|
"disabling min aspect ratio constraint.",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc);
|
|
|
|
window->size_hints.min_aspect.x = 1;
|
|
|
|
window->size_hints.min_aspect.y = G_MAXINT;
|
|
|
|
}
|
|
|
|
if (maxr < (minw / (double)maxh))
|
|
|
|
{
|
|
|
|
/* another cracksmoker */
|
|
|
|
meta_topic (META_DEBUG_GEOMETRY,
|
|
|
|
"Window %s sets max aspect ratio smaller than smallest "
|
|
|
|
"aspect ratio possible given min/max size constraints; "
|
2020-10-02 11:47:22 -04:00
|
|
|
"disabling max aspect ratio constraint.",
|
2007-04-04 17:54:56 -04:00
|
|
|
window->desc);
|
|
|
|
window->size_hints.max_aspect.x = G_MAXINT;
|
|
|
|
window->size_hints.max_aspect.y = 1;
|
|
|
|
}
|
|
|
|
/* FIXME: Would be nice to check that aspect ratios are
|
|
|
|
* consistent with base and size increment constraints.
|
|
|
|
*/
|
2003-04-26 13:40:32 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-02-27 20:24:44 -05:00
|
|
|
static void
|
|
|
|
reload_normal_hints (MetaWindow *window,
|
2009-01-26 22:53:07 -05:00
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
2003-02-27 20:24:44 -05:00
|
|
|
{
|
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
|
|
|
{
|
|
|
|
XSizeHints old_hints;
|
window-props: Check for actual size hints changes
The XSizeHints set by X11 clients give a hint to the window manager
about size increment, aspect ratio, base, minimum and maximum size, etc.
When an X11 client changes those values, there is a good chance that it
will affect the actual window size in some way, and mutter rightfully
queue a window resize in that case.
However, mutter does not check if any of the hints have actually changed
and unconditionally queue a window resize whenever a client changes its
WM_NORMAL_HINTS property.
That can be a problem when a zealous client such as xterm decides to
update its WM_NORMAL_HINTS property on resize, because in return mutter
will queue a non-user driven resize in the middle of user-driven events,
hence defeating the purpose of the META_MOVE_RESIZE_USER_ACTION flag.
To avoid that issue, make mutter a bit smarter and avoid queuing a
window resize if the XSizeHints haven't actually changed.
https://gitlab.gnome.org/GNOME/mutter/-/issues/543
2020-10-15 08:23:41 -04:00
|
|
|
gboolean hints_have_differences;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_GEOMETRY, "Updating WM_NORMAL_HINTS for %s", window->desc);
|
2003-02-27 20:24:44 -05:00
|
|
|
|
|
|
|
old_hints = window->size_hints;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2003-04-26 13:40:32 -04:00
|
|
|
meta_set_normal_hints (window, value->v.size_hints.hints);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
window-props: Check for actual size hints changes
The XSizeHints set by X11 clients give a hint to the window manager
about size increment, aspect ratio, base, minimum and maximum size, etc.
When an X11 client changes those values, there is a good chance that it
will affect the actual window size in some way, and mutter rightfully
queue a window resize in that case.
However, mutter does not check if any of the hints have actually changed
and unconditionally queue a window resize whenever a client changes its
WM_NORMAL_HINTS property.
That can be a problem when a zealous client such as xterm decides to
update its WM_NORMAL_HINTS property on resize, because in return mutter
will queue a non-user driven resize in the middle of user-driven events,
hence defeating the purpose of the META_MOVE_RESIZE_USER_ACTION flag.
To avoid that issue, make mutter a bit smarter and avoid queuing a
window resize if the XSizeHints haven't actually changed.
https://gitlab.gnome.org/GNOME/mutter/-/issues/543
2020-10-15 08:23:41 -04:00
|
|
|
hints_have_differences = hints_have_changed (&old_hints,
|
|
|
|
&window->size_hints);
|
|
|
|
if (hints_have_differences)
|
|
|
|
{
|
|
|
|
spew_size_hints_differences (&old_hints, &window->size_hints);
|
|
|
|
meta_window_recalc_features (window);
|
2003-02-27 20:24:44 -05:00
|
|
|
|
window-props: Check for actual size hints changes
The XSizeHints set by X11 clients give a hint to the window manager
about size increment, aspect ratio, base, minimum and maximum size, etc.
When an X11 client changes those values, there is a good chance that it
will affect the actual window size in some way, and mutter rightfully
queue a window resize in that case.
However, mutter does not check if any of the hints have actually changed
and unconditionally queue a window resize whenever a client changes its
WM_NORMAL_HINTS property.
That can be a problem when a zealous client such as xterm decides to
update its WM_NORMAL_HINTS property on resize, because in return mutter
will queue a non-user driven resize in the middle of user-driven events,
hence defeating the purpose of the META_MOVE_RESIZE_USER_ACTION flag.
To avoid that issue, make mutter a bit smarter and avoid queuing a
window resize if the XSizeHints haven't actually changed.
https://gitlab.gnome.org/GNOME/mutter/-/issues/543
2020-10-15 08:23:41 -04:00
|
|
|
if (!initial)
|
|
|
|
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
|
|
|
|
}
|
2003-02-27 20:24:44 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reload_wm_protocols (MetaWindow *window,
|
2009-01-26 22:53:07 -05:00
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
2003-02-27 20:24:44 -05:00
|
|
|
{
|
|
|
|
int i;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2019-01-30 14:19:41 -05:00
|
|
|
meta_window_x11_set_wm_take_focus (window, FALSE);
|
2019-01-30 14:41:11 -05:00
|
|
|
meta_window_x11_set_wm_ping (window, FALSE);
|
2019-01-30 14:40:17 -05:00
|
|
|
meta_window_x11_set_wm_delete_window (window, FALSE);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
|
|
|
if (value->type == META_PROP_VALUE_INVALID)
|
2003-02-27 20:24:44 -05:00
|
|
|
return;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < value->v.atom_list.n_atoms)
|
|
|
|
{
|
|
|
|
if (value->v.atom_list.atoms[i] ==
|
2017-08-26 12:26:30 -04:00
|
|
|
window->display->x11_display->atom_WM_TAKE_FOCUS)
|
2019-01-30 14:19:41 -05:00
|
|
|
meta_window_x11_set_wm_take_focus (window, TRUE);
|
2003-02-27 20:24:44 -05:00
|
|
|
else if (value->v.atom_list.atoms[i] ==
|
2017-08-26 12:26:30 -04:00
|
|
|
window->display->x11_display->atom_WM_DELETE_WINDOW)
|
2019-01-30 14:40:17 -05:00
|
|
|
meta_window_x11_set_wm_delete_window (window, TRUE);
|
2003-02-27 20:24:44 -05:00
|
|
|
else if (value->v.atom_list.atoms[i] ==
|
2017-08-26 12:26:30 -04:00
|
|
|
window->display->x11_display->atom__NET_WM_PING)
|
2019-01-30 14:41:11 -05:00
|
|
|
meta_window_x11_set_wm_ping (window, TRUE);
|
2003-02-27 20:24:44 -05:00
|
|
|
++i;
|
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("New _NET_STARTUP_ID \"%s\" for %s",
|
2003-02-27 20:24:44 -05:00
|
|
|
window->startup_id ? window->startup_id : "unset",
|
|
|
|
window->desc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reload_wm_hints (MetaWindow *window,
|
2009-01-26 22:53:07 -05:00
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
2003-02-27 20:24:44 -05:00
|
|
|
{
|
2014-07-14 12:01:22 -04:00
|
|
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
2019-08-20 15:38:35 -04:00
|
|
|
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
2003-02-27 20:24:44 -05:00
|
|
|
Window old_group_leader;
|
2014-03-18 13:51:36 -04:00
|
|
|
gboolean urgent;
|
2009-11-20 03:51:19 -05:00
|
|
|
|
2003-02-27 20:24:44 -05:00
|
|
|
old_group_leader = window->xgroup_leader;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2003-02-27 20:24:44 -05:00
|
|
|
/* Fill in defaults */
|
|
|
|
window->input = TRUE;
|
|
|
|
window->initially_iconic = FALSE;
|
|
|
|
window->xgroup_leader = None;
|
2014-07-14 12:01:22 -04:00
|
|
|
priv->wm_hints_pixmap = None;
|
|
|
|
priv->wm_hints_mask = None;
|
2014-03-18 13:51:36 -04:00
|
|
|
urgent = FALSE;
|
2009-11-20 03:51:19 -05:00
|
|
|
|
2003-02-27 20:24:44 -05:00
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
|
|
|
{
|
|
|
|
const XWMHints *hints = value->v.wm_hints;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2003-02-27 20:24:44 -05:00
|
|
|
if (hints->flags & InputHint)
|
|
|
|
window->input = hints->input;
|
|
|
|
|
|
|
|
if (hints->flags & StateHint)
|
|
|
|
window->initially_iconic = (hints->initial_state == IconicState);
|
|
|
|
|
|
|
|
if (hints->flags & WindowGroupHint)
|
|
|
|
window->xgroup_leader = hints->window_group;
|
|
|
|
|
|
|
|
if (hints->flags & IconPixmapHint)
|
2014-07-14 12:01:22 -04:00
|
|
|
priv->wm_hints_pixmap = hints->icon_pixmap;
|
2003-02-27 20:24:44 -05:00
|
|
|
|
|
|
|
if (hints->flags & IconMaskHint)
|
2014-07-14 12:01:22 -04:00
|
|
|
priv->wm_hints_mask = hints->icon_mask;
|
2009-11-20 03:51:19 -05:00
|
|
|
|
|
|
|
if (hints->flags & XUrgencyHint)
|
2014-03-18 13:51:36 -04:00
|
|
|
urgent = TRUE;
|
2009-11-20 03:51:19 -05:00
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Read WM_HINTS input: %d iconic: %d group leader: 0x%lx pixmap: 0x%lx mask: 0x%lx",
|
2003-02-27 20:24:44 -05:00
|
|
|
window->input, window->initially_iconic,
|
|
|
|
window->xgroup_leader,
|
2014-07-14 12:01:22 -04:00
|
|
|
priv->wm_hints_pixmap,
|
|
|
|
priv->wm_hints_mask);
|
2003-02-27 20:24:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (window->xgroup_leader != old_group_leader)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Window %s changed its group leader to 0x%lx",
|
2003-02-27 20:24:44 -05:00
|
|
|
window->desc, window->xgroup_leader);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2003-02-27 20:24:44 -05:00
|
|
|
meta_window_group_leader_changed (window);
|
|
|
|
}
|
|
|
|
|
2014-03-18 13:51:36 -04:00
|
|
|
meta_window_set_urgent (window, urgent);
|
2009-11-17 05:24:18 -05:00
|
|
|
|
2014-07-14 12:01:22 -04:00
|
|
|
meta_icon_cache_property_changed (&priv->icon_cache,
|
2017-08-26 14:54:39 -04:00
|
|
|
window->display->x11_display,
|
2003-02-27 20:24:44 -05:00
|
|
|
XA_WM_HINTS);
|
|
|
|
|
2022-01-28 18:02:24 -05:00
|
|
|
meta_window_x11_queue_update_icon (window_x11);
|
|
|
|
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
|
2003-02-27 20:24:44 -05:00
|
|
|
}
|
|
|
|
|
2019-10-29 12:14:43 -04:00
|
|
|
static gboolean
|
|
|
|
check_xtransient_for_loop (MetaWindow *window,
|
|
|
|
MetaWindow *parent)
|
|
|
|
{
|
|
|
|
while (parent)
|
|
|
|
{
|
|
|
|
if (parent == window)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
parent = meta_x11_display_lookup_x_window (parent->display->x11_display,
|
|
|
|
parent->xtransient_for);
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
static void
|
|
|
|
reload_transient_for (MetaWindow *window,
|
2009-01-26 22:53:07 -05:00
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
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
|
|
|
{
|
2011-05-06 05:09:04 -04:00
|
|
|
MetaWindow *parent = NULL;
|
2013-09-16 08:44:37 -04:00
|
|
|
Window transient_for;
|
2011-05-06 05:09:04 -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
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
2011-05-06 05:09:04 -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
|
|
|
transient_for = value->v.xwindow;
|
|
|
|
|
2017-08-26 12:56:44 -04:00
|
|
|
parent = meta_x11_display_lookup_x_window (window->display->x11_display,
|
|
|
|
transient_for);
|
2011-05-06 05:09:04 -04:00
|
|
|
if (!parent)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_warning ("Invalid WM_TRANSIENT_FOR window 0x%lx specified for %s.",
|
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
|
|
|
transient_for, window->desc);
|
|
|
|
transient_for = None;
|
2011-05-06 05:09:04 -04:00
|
|
|
}
|
2019-10-28 23:22:19 -04:00
|
|
|
else if (parent->override_redirect)
|
|
|
|
{
|
2019-10-29 14:08:01 -04:00
|
|
|
const gchar *window_kind = window->override_redirect ?
|
|
|
|
"override-redirect" : "top-level";
|
|
|
|
|
|
|
|
if (parent->xtransient_for != None)
|
|
|
|
{
|
|
|
|
/* We don't have to go through the parents, as per this code it is
|
|
|
|
* not possible that a window has the WM_TRANSIENT_FOR set to an
|
|
|
|
* override-redirect window anyways */
|
|
|
|
meta_warning ("WM_TRANSIENT_FOR window %s for %s window %s is an "
|
|
|
|
"override-redirect window and this is not correct "
|
|
|
|
"according to the standard, so we'll fallback to "
|
2020-10-02 11:47:22 -04:00
|
|
|
"the first non-override-redirect window 0x%lx.",
|
2019-10-29 14:08:01 -04:00
|
|
|
parent->desc, window->desc, window_kind,
|
|
|
|
parent->xtransient_for);
|
|
|
|
transient_for = parent->xtransient_for;
|
|
|
|
parent =
|
|
|
|
meta_x11_display_lookup_x_window (parent->display->x11_display,
|
|
|
|
transient_for);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_warning ("WM_TRANSIENT_FOR window %s for %s window %s is an "
|
|
|
|
"override-redirect window and this is not correct "
|
|
|
|
"according to the standard, so we'll fallback to "
|
2020-10-02 11:47:22 -04:00
|
|
|
"the root window.", parent->desc, window_kind,
|
2019-10-29 14:08:01 -04:00
|
|
|
window->desc);
|
|
|
|
transient_for = parent->display->x11_display->xroot;
|
|
|
|
parent = NULL;
|
|
|
|
}
|
2019-10-28 23:22:19 -04:00
|
|
|
}
|
2011-05-06 05:09:04 -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
|
|
|
/* Make sure there is not a loop */
|
2019-10-29 12:14:43 -04:00
|
|
|
if (check_xtransient_for_loop (window, parent))
|
2011-05-06 05:09:04 -04:00
|
|
|
{
|
2019-10-29 12:14:43 -04:00
|
|
|
meta_warning ("WM_TRANSIENT_FOR window 0x%lx for %s would create a "
|
2020-10-02 11:47:22 -04:00
|
|
|
"loop.", transient_for, window->desc);
|
2019-10-29 12:14:43 -04:00
|
|
|
transient_for = None;
|
2011-05-06 05:09:04 -04:00
|
|
|
}
|
2006-04-19 16:55:49 -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
|
|
|
else
|
|
|
|
transient_for = None;
|
|
|
|
|
|
|
|
if (transient_for == window->xtransient_for)
|
|
|
|
return;
|
|
|
|
|
|
|
|
window->xtransient_for = transient_for;
|
2006-04-19 16:55:49 -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
|
|
|
if (window->xtransient_for != None)
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Window %s transient for 0x%lx", window->desc, window->xtransient_for);
|
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
|
|
|
else
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Window %s is not transient", window->desc);
|
2003-02-27 20:24:44 -05:00
|
|
|
|
2017-08-26 12:26:30 -04:00
|
|
|
if (window->xtransient_for == None ||
|
|
|
|
window->xtransient_for == window->display->x11_display->xroot)
|
2013-09-16 08:44:37 -04:00
|
|
|
meta_window_set_transient_for (window, NULL);
|
|
|
|
else
|
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
|
|
|
{
|
2013-09-16 08:44:37 -04:00
|
|
|
meta_window_set_transient_for (window, parent);
|
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
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2011-03-19 05:31:25 -04:00
|
|
|
static void
|
|
|
|
reload_gtk_theme_variant (MetaWindow *window,
|
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
|
|
|
{
|
|
|
|
char *requested_variant = NULL;
|
|
|
|
char *current_variant = window->gtk_theme_variant;
|
|
|
|
|
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
|
|
|
{
|
|
|
|
requested_variant = value->v.str;
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Requested \"%s\" theme variant for window %s.",
|
2011-03-19 05:31:25 -04:00
|
|
|
requested_variant, window->desc);
|
|
|
|
}
|
|
|
|
|
2011-11-25 18:42:41 -05:00
|
|
|
if (g_strcmp0 (requested_variant, current_variant) != 0)
|
2011-03-19 05:31:25 -04:00
|
|
|
{
|
|
|
|
g_free (current_variant);
|
|
|
|
|
2011-11-25 18:42:41 -05:00
|
|
|
window->gtk_theme_variant = g_strdup (requested_variant);
|
2011-03-20 17:56:08 -04:00
|
|
|
|
|
|
|
if (window->frame)
|
2015-01-01 00:24:49 -05:00
|
|
|
meta_frame_update_style (window->frame);
|
2011-03-19 05:31:25 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-30 02:40:18 -04:00
|
|
|
static void
|
|
|
|
reload_bypass_compositor (MetaWindow *window,
|
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
|
|
|
{
|
2019-08-20 15:46:50 -04:00
|
|
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
|
|
|
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
|
|
|
MetaBypassCompositorHint requested_value;
|
|
|
|
MetaBypassCompositorHint current_value;
|
2012-08-30 02:40:18 -04:00
|
|
|
|
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
2019-08-20 15:46:50 -04:00
|
|
|
requested_value = (MetaBypassCompositorHint) value->v.cardinal;
|
|
|
|
else
|
|
|
|
requested_value = META_BYPASS_COMPOSITOR_HINT_AUTO;
|
2012-08-30 02:40:18 -04:00
|
|
|
|
2019-08-20 15:46:50 -04:00
|
|
|
current_value = priv->bypass_compositor;
|
2012-08-30 02:40:18 -04:00
|
|
|
if (requested_value == current_value)
|
|
|
|
return;
|
|
|
|
|
2019-08-20 15:46:50 -04:00
|
|
|
if (requested_value == META_BYPASS_COMPOSITOR_HINT_ON)
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Request to bypass compositor for window %s.", window->desc);
|
2019-08-20 15:46:50 -04:00
|
|
|
else if (requested_value == META_BYPASS_COMPOSITOR_HINT_OFF)
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_verbose ("Request to don't bypass compositor for window %s.", window->desc);
|
2019-08-20 15:46:50 -04:00
|
|
|
else if (requested_value != META_BYPASS_COMPOSITOR_HINT_AUTO)
|
2012-08-30 02:40:18 -04:00
|
|
|
return;
|
|
|
|
|
2019-08-20 15:46:50 -04:00
|
|
|
priv->bypass_compositor = requested_value;
|
2012-08-30 02:40:18 -04:00
|
|
|
}
|
|
|
|
|
2013-12-06 13:44:31 -05:00
|
|
|
static void
|
|
|
|
reload_window_opacity (MetaWindow *window,
|
|
|
|
MetaPropValue *value,
|
|
|
|
gboolean initial)
|
|
|
|
|
|
|
|
{
|
2014-04-09 01:57:52 -04:00
|
|
|
guint8 opacity = 0xFF;
|
2013-12-06 13:44:31 -05:00
|
|
|
|
|
|
|
if (value->type != META_PROP_VALUE_INVALID)
|
2014-04-09 01:57:52 -04:00
|
|
|
opacity = (guint8)((gfloat)value->v.cardinal * 255.0 / ((gfloat)0xffffffff));
|
2013-12-06 13:44:31 -05:00
|
|
|
|
2014-04-09 01:57:52 -04:00
|
|
|
meta_window_set_opacity (window, opacity);
|
2013-12-06 13:44:31 -05:00
|
|
|
}
|
|
|
|
|
2012-01-17 13:27:10 -05:00
|
|
|
#define RELOAD_STRING(var_name, propname) \
|
|
|
|
static void \
|
|
|
|
reload_ ## var_name (MetaWindow *window, \
|
|
|
|
MetaPropValue *value, \
|
|
|
|
gboolean initial) \
|
|
|
|
{ \
|
|
|
|
g_free (window->var_name); \
|
|
|
|
\
|
|
|
|
if (value->type != META_PROP_VALUE_INVALID) \
|
|
|
|
window->var_name = g_strdup (value->v.str); \
|
|
|
|
else \
|
|
|
|
window->var_name = NULL; \
|
|
|
|
\
|
|
|
|
g_object_notify (G_OBJECT (window), propname); \
|
|
|
|
}
|
2011-12-05 12:52:35 -05:00
|
|
|
|
2012-01-17 13:27:10 -05:00
|
|
|
RELOAD_STRING (gtk_unique_bus_name, "gtk-unique-bus-name")
|
|
|
|
RELOAD_STRING (gtk_application_id, "gtk-application-id")
|
|
|
|
RELOAD_STRING (gtk_application_object_path, "gtk-application-object-path")
|
|
|
|
RELOAD_STRING (gtk_window_object_path, "gtk-window-object-path")
|
|
|
|
RELOAD_STRING (gtk_app_menu_object_path, "gtk-app-menu-object-path")
|
|
|
|
RELOAD_STRING (gtk_menubar_object_path, "gtk-menubar-object-path")
|
2011-12-05 12:52:35 -05:00
|
|
|
|
2012-01-17 13:27:10 -05:00
|
|
|
#undef RELOAD_STRING
|
2011-12-05 12:52:35 -05:00
|
|
|
|
2009-01-29 09:32:31 -05:00
|
|
|
/**
|
2017-08-26 12:58:29 -04:00
|
|
|
* meta_x11_display_init_window_prop_hooks:
|
|
|
|
* @x11_display: The #MetaDX11isplay
|
2011-11-02 11:34:45 -04:00
|
|
|
*
|
2009-01-29 09:32:31 -05:00
|
|
|
* Initialises the property hooks system. Each row in the table named "hooks"
|
|
|
|
* represents an action to take when a property is found on a newly-created
|
|
|
|
* window, or when a property changes its value.
|
|
|
|
*
|
|
|
|
* The first column shows which atom the row concerns.
|
|
|
|
* The second gives the type of the property data. The property will be
|
|
|
|
* queried for its new value, unless the type is given as
|
|
|
|
* META_PROP_VALUE_INVALID, in which case nothing will be queried.
|
|
|
|
* The third column gives the name of a callback which gets called with the
|
|
|
|
* new value. (If the new value was not retrieved because the second column
|
|
|
|
* was META_PROP_VALUE_INVALID, the callback still gets called anyway.)
|
|
|
|
* This value may be NULL, in which case no callback will be called.
|
|
|
|
*/
|
2002-11-03 18:42:21 -05:00
|
|
|
void
|
2017-08-26 12:58:29 -04:00
|
|
|
meta_x11_display_init_window_prop_hooks (MetaX11Display *x11_display)
|
2002-11-03 18:42:21 -05:00
|
|
|
{
|
2014-07-10 14:31:25 -04:00
|
|
|
/* The ordering here is significant for the properties we load
|
2009-06-14 08:37:57 -04:00
|
|
|
* initially: they are roughly ordered in the order we want them to
|
|
|
|
* be gotten. We want to get window name and class first so we can
|
|
|
|
* use them in error messages and such. However, name is modified
|
|
|
|
* depending on wm_client_machine, so push it slightly sooner.
|
|
|
|
*
|
|
|
|
* For override-redirect windows, we pay attention to:
|
|
|
|
*
|
|
|
|
* - properties that identify the window: useful for debugging
|
|
|
|
* purposes.
|
|
|
|
* - NET_WM_WINDOW_TYPE: can be used to do appropriate handling
|
|
|
|
* for different types of override-redirect windows.
|
|
|
|
*/
|
2014-07-10 14:31:25 -04:00
|
|
|
MetaWindowPropHooks hooks[] = {
|
2017-08-26 12:26:30 -04:00
|
|
|
{ x11_display->atom_WM_CLIENT_MACHINE, META_PROP_VALUE_STRING, reload_wm_client_machine, LOAD_INIT | INCLUDE_OR },
|
|
|
|
{ x11_display->atom__NET_WM_NAME, META_PROP_VALUE_UTF8, reload_net_wm_name, LOAD_INIT | INCLUDE_OR },
|
|
|
|
{ XA_WM_CLASS, META_PROP_VALUE_CLASS_HINT, reload_wm_class, LOAD_INIT | INCLUDE_OR },
|
|
|
|
{ XA_WM_NAME, META_PROP_VALUE_TEXT_PROPERTY, reload_wm_name, LOAD_INIT | INCLUDE_OR },
|
|
|
|
{ x11_display->atom__MUTTER_HINTS, META_PROP_VALUE_TEXT_PROPERTY, reload_mutter_hints, LOAD_INIT | INCLUDE_OR },
|
|
|
|
{ x11_display->atom__NET_WM_OPAQUE_REGION, META_PROP_VALUE_CARDINAL_LIST, reload_opaque_region, LOAD_INIT | INCLUDE_OR },
|
|
|
|
{ x11_display->atom__NET_WM_DESKTOP, META_PROP_VALUE_CARDINAL, reload_net_wm_desktop, LOAD_INIT | INIT_ONLY },
|
|
|
|
{ x11_display->atom__NET_STARTUP_ID, META_PROP_VALUE_UTF8, reload_net_startup_id, LOAD_INIT },
|
|
|
|
{ x11_display->atom__NET_WM_SYNC_REQUEST_COUNTER, META_PROP_VALUE_SYNC_COUNTER_LIST, reload_update_counter, LOAD_INIT | INCLUDE_OR },
|
|
|
|
{ XA_WM_NORMAL_HINTS, META_PROP_VALUE_SIZE_HINTS, reload_normal_hints, LOAD_INIT },
|
|
|
|
{ x11_display->atom_WM_PROTOCOLS, META_PROP_VALUE_ATOM_LIST, reload_wm_protocols, LOAD_INIT },
|
|
|
|
{ XA_WM_HINTS, META_PROP_VALUE_WM_HINTS, reload_wm_hints, LOAD_INIT },
|
|
|
|
{ x11_display->atom__NET_WM_USER_TIME, META_PROP_VALUE_CARDINAL, reload_net_wm_user_time, LOAD_INIT },
|
|
|
|
{ x11_display->atom__NET_WM_STATE, META_PROP_VALUE_ATOM_LIST, reload_net_wm_state, LOAD_INIT | INIT_ONLY },
|
|
|
|
{ x11_display->atom__MOTIF_WM_HINTS, META_PROP_VALUE_MOTIF_HINTS, reload_mwm_hints, LOAD_INIT },
|
2019-10-29 14:08:01 -04:00
|
|
|
{ XA_WM_TRANSIENT_FOR, META_PROP_VALUE_WINDOW, reload_transient_for, LOAD_INIT | INCLUDE_OR },
|
2017-08-26 12:26:30 -04:00
|
|
|
{ x11_display->atom__GTK_THEME_VARIANT, META_PROP_VALUE_UTF8, reload_gtk_theme_variant, LOAD_INIT },
|
|
|
|
{ x11_display->atom__GTK_APPLICATION_ID, META_PROP_VALUE_UTF8, reload_gtk_application_id, LOAD_INIT },
|
|
|
|
{ x11_display->atom__GTK_UNIQUE_BUS_NAME, META_PROP_VALUE_UTF8, reload_gtk_unique_bus_name, LOAD_INIT },
|
|
|
|
{ x11_display->atom__GTK_APPLICATION_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_gtk_application_object_path, LOAD_INIT },
|
|
|
|
{ x11_display->atom__GTK_WINDOW_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_gtk_window_object_path, LOAD_INIT },
|
|
|
|
{ x11_display->atom__GTK_APP_MENU_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_gtk_app_menu_object_path, LOAD_INIT },
|
|
|
|
{ x11_display->atom__GTK_MENUBAR_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_gtk_menubar_object_path, LOAD_INIT },
|
|
|
|
{ x11_display->atom__GTK_FRAME_EXTENTS, META_PROP_VALUE_CARDINAL_LIST,reload_gtk_frame_extents, LOAD_INIT },
|
|
|
|
{ x11_display->atom__NET_WM_USER_TIME_WINDOW, META_PROP_VALUE_WINDOW, reload_net_wm_user_time_window, LOAD_INIT },
|
|
|
|
{ x11_display->atom__NET_WM_ICON, META_PROP_VALUE_INVALID, reload_net_wm_icon, NONE },
|
|
|
|
{ x11_display->atom__KWM_WIN_ICON, META_PROP_VALUE_INVALID, reload_kwm_win_icon, NONE },
|
|
|
|
{ x11_display->atom__NET_WM_ICON_GEOMETRY, META_PROP_VALUE_CARDINAL_LIST, reload_icon_geometry, LOAD_INIT },
|
|
|
|
{ x11_display->atom_WM_CLIENT_LEADER, META_PROP_VALUE_INVALID, complain_about_broken_client, NONE },
|
|
|
|
{ x11_display->atom_SM_CLIENT_ID, META_PROP_VALUE_INVALID, complain_about_broken_client, NONE },
|
|
|
|
{ x11_display->atom_WM_WINDOW_ROLE, META_PROP_VALUE_STRING, reload_wm_window_role, LOAD_INIT | FORCE_INIT },
|
|
|
|
{ x11_display->atom__NET_WM_WINDOW_TYPE, META_PROP_VALUE_ATOM_LIST, reload_net_wm_window_type, LOAD_INIT | INCLUDE_OR | FORCE_INIT },
|
|
|
|
{ x11_display->atom__NET_WM_STRUT, META_PROP_VALUE_INVALID, reload_struts, NONE },
|
|
|
|
{ x11_display->atom__NET_WM_STRUT_PARTIAL, META_PROP_VALUE_INVALID, reload_struts, NONE },
|
|
|
|
{ x11_display->atom__NET_WM_BYPASS_COMPOSITOR, META_PROP_VALUE_CARDINAL, reload_bypass_compositor, LOAD_INIT | INCLUDE_OR },
|
|
|
|
{ x11_display->atom__NET_WM_WINDOW_OPACITY, META_PROP_VALUE_CARDINAL, reload_window_opacity, LOAD_INIT | INCLUDE_OR },
|
2009-01-29 09:32:31 -05:00
|
|
|
{ 0 },
|
|
|
|
};
|
2021-02-04 12:45:59 -05:00
|
|
|
MetaWindowPropHooks *table;
|
|
|
|
MetaWindowPropHooks *cursor;
|
2009-01-29 09:32:31 -05:00
|
|
|
|
2021-02-04 12:45:59 -05:00
|
|
|
table = g_memdup2 (hooks, sizeof (hooks)),
|
|
|
|
cursor = table;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2017-08-26 12:58:29 -04:00
|
|
|
g_assert (x11_display->prop_hooks == NULL);
|
2002-11-03 18:42:21 -05:00
|
|
|
|
2017-08-26 12:58:29 -04:00
|
|
|
x11_display->prop_hooks_table = (gpointer) table;
|
|
|
|
x11_display->prop_hooks = g_hash_table_new (NULL, NULL);
|
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-01-29 09:32:31 -05:00
|
|
|
while (cursor->property)
|
2008-05-04 13:57:11 -04:00
|
|
|
{
|
2009-06-14 08:37:57 -04:00
|
|
|
/* Doing initial loading doesn't make sense if we just want notification */
|
2014-07-10 14:31:25 -04:00
|
|
|
g_assert (!((cursor->flags & LOAD_INIT) && cursor->type == META_PROP_VALUE_INVALID));
|
2009-06-14 08:37:57 -04:00
|
|
|
|
2014-08-01 09:23:47 -04:00
|
|
|
/* Forcing initialization doesn't make sense if not loading initially */
|
|
|
|
g_assert ((cursor->flags & LOAD_INIT) || !(cursor->flags & FORCE_INIT));
|
|
|
|
|
2009-01-29 09:32:31 -05:00
|
|
|
/* Atoms are safe to use with GINT_TO_POINTER because it's safe with
|
|
|
|
* anything 32 bits or less, and atoms are 32 bits with the top three
|
|
|
|
* bits clear. (Scheifler & Gettys, 2e, p372)
|
|
|
|
*/
|
2017-08-26 12:58:29 -04:00
|
|
|
g_hash_table_insert (x11_display->prop_hooks,
|
2009-01-29 09:32:31 -05:00
|
|
|
GINT_TO_POINTER (cursor->property),
|
|
|
|
cursor);
|
|
|
|
cursor++;
|
2008-05-04 13:57:11 -04:00
|
|
|
}
|
2017-08-26 12:58:29 -04:00
|
|
|
x11_display->n_prop_hooks = cursor - table;
|
2002-11-03 18:42:21 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-08-26 12:58:29 -04:00
|
|
|
meta_x11_display_free_window_prop_hooks (MetaX11Display *x11_display)
|
2002-11-03 18:42:21 -05:00
|
|
|
{
|
2017-08-26 12:58:29 -04:00
|
|
|
g_hash_table_unref (x11_display->prop_hooks);
|
|
|
|
x11_display->prop_hooks = NULL;
|
2009-01-29 09:32:31 -05:00
|
|
|
|
2017-08-26 12:58:29 -04:00
|
|
|
g_free (x11_display->prop_hooks_table);
|
|
|
|
x11_display->prop_hooks_table = NULL;
|
2002-11-03 18:42:21 -05:00
|
|
|
}
|
|
|
|
|
2017-08-26 12:58:29 -04:00
|
|
|
static MetaWindowPropHooks *
|
|
|
|
find_hooks (MetaX11Display *x11_display,
|
|
|
|
Atom property)
|
2002-11-03 18:42:21 -05:00
|
|
|
{
|
2017-08-26 12:58:29 -04:00
|
|
|
return g_hash_table_lookup (x11_display->prop_hooks,
|
2009-01-29 09:32:31 -05:00
|
|
|
GINT_TO_POINTER (property));
|
2002-11-03 18:42:21 -05:00
|
|
|
}
|