2006-10-01 22:30:10 +00:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
/*
|
2002-06-08 23:55:27 +00:00
|
|
|
* Copyright (C) 2001, 2002 Havoc Pennington
|
2003-01-23 01:53:18 +00:00
|
|
|
* Copyright (C) 2002, 2003 Red Hat Inc.
|
2002-06-08 23:55:27 +00:00
|
|
|
* Some ICCCM manager selection code derived from fvwm2,
|
2002-07-10 14:41:19 +00:00
|
|
|
* Copyright (C) 2001 Dominik Vogt, Matthias Clasen, and fvwm2 team
|
2003-02-23 17:09:46 +00:00
|
|
|
* Copyright (C) 2003 Rob Adams
|
2006-01-10 19:43:21 +00:00
|
|
|
* Copyright (C) 2004-2006 Elijah Newren
|
2014-05-02 13:34:02 +00:00
|
|
|
*
|
2001-05-30 15:36:31 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
2014-05-02 13:34:02 +00:00
|
|
|
*
|
2001-05-30 15:36:31 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-12 01:42:06 +00:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2001-05-30 15:36:31 +00:00
|
|
|
*/
|
2001-05-31 06:42:58 +00:00
|
|
|
|
2013-03-11 15:52:36 +00:00
|
|
|
/**
|
|
|
|
* SECTION:screen
|
|
|
|
* @title: MetaScreen
|
|
|
|
* @short_description: Mutter X screen handler
|
|
|
|
*/
|
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
#include <config.h>
|
2008-05-19 00:00:09 +00:00
|
|
|
#include "screen-private.h"
|
2011-03-23 17:11:05 +00:00
|
|
|
#include <meta/main.h>
|
2013-09-11 08:18:53 +00:00
|
|
|
#include "util-private.h"
|
2011-03-06 00:29:12 +00:00
|
|
|
#include <meta/errors.h>
|
2008-05-19 00:00:09 +00:00
|
|
|
#include "window-private.h"
|
2011-03-06 00:29:12 +00:00
|
|
|
#include "frame.h"
|
|
|
|
#include <meta/prefs.h>
|
2008-09-18 15:09:11 +00:00
|
|
|
#include "workspace-private.h"
|
2009-01-29 14:16:01 +00:00
|
|
|
#include "keybindings-private.h"
|
2001-06-10 18:46:46 +00:00
|
|
|
#include "stack.h"
|
2011-03-06 00:29:12 +00:00
|
|
|
#include <meta/compositor.h>
|
2015-07-06 04:58:45 +00:00
|
|
|
#include <meta/meta-enum-types.h>
|
2013-02-07 23:20:03 +00:00
|
|
|
#include "core.h"
|
2013-08-13 10:57:41 +00:00
|
|
|
#include "meta-cursor-tracker-private.h"
|
2015-07-17 15:16:39 +00:00
|
|
|
#include "boxes-private.h"
|
2016-12-01 04:52:07 +00:00
|
|
|
#include "backends/meta-backend-private.h"
|
2016-12-13 02:37:11 +00:00
|
|
|
#include "backends/meta-logical-monitor.h"
|
2001-06-01 03:00:01 +00:00
|
|
|
|
2002-04-21 19:35:02 +00:00
|
|
|
#include <X11/extensions/Xinerama.h>
|
2014-07-10 18:03:03 +00:00
|
|
|
#include <X11/extensions/Xcomposite.h>
|
2012-04-24 19:18:46 +00:00
|
|
|
|
2001-06-10 03:17:15 +00:00
|
|
|
#include <X11/Xatom.h>
|
2001-06-01 03:00:01 +00:00
|
|
|
#include <locale.h>
|
|
|
|
#include <string.h>
|
2002-06-08 23:55:27 +00:00
|
|
|
#include <stdio.h>
|
2013-03-04 14:57:01 +00:00
|
|
|
#include <stdlib.h>
|
2001-05-30 15:36:31 +00:00
|
|
|
|
2017-08-26 16:26:30 +00:00
|
|
|
#include "x11/meta-x11-display-private.h"
|
2014-05-20 13:18:45 +00:00
|
|
|
#include "x11/window-x11.h"
|
2014-03-19 01:56:45 +00:00
|
|
|
#include "x11/xprops.h"
|
|
|
|
|
2014-07-15 21:13:31 +00:00
|
|
|
#include "backends/x11/meta-backend-x11.h"
|
2018-04-27 13:43:37 +00:00
|
|
|
#include "backends/meta-cursor-sprite-xcursor.h"
|
2014-07-15 21:13:31 +00:00
|
|
|
|
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 17:27:24 +00:00
|
|
|
static void update_num_workspaces (MetaScreen *screen,
|
|
|
|
guint32 timestamp);
|
2003-02-14 07:03:46 +00:00
|
|
|
static void set_workspace_names (MetaScreen *screen);
|
2001-12-10 03:55:26 +00:00
|
|
|
static void prefs_changed_callback (MetaPreference pref,
|
|
|
|
gpointer data);
|
2001-06-03 01:33:27 +00:00
|
|
|
|
2008-11-17 22:22:28 +00:00
|
|
|
enum
|
|
|
|
{
|
2009-05-05 08:39:29 +00:00
|
|
|
PROP_N_WORKSPACES = 1,
|
2008-11-17 22:22:28 +00:00
|
|
|
};
|
|
|
|
|
2009-03-12 21:07:27 +00:00
|
|
|
enum
|
|
|
|
{
|
2009-07-02 15:19:02 +00:00
|
|
|
WORKSPACE_ADDED,
|
|
|
|
WORKSPACE_REMOVED,
|
|
|
|
WORKSPACE_SWITCHED,
|
2011-02-28 20:26:11 +00:00
|
|
|
WINDOW_ENTERED_MONITOR,
|
|
|
|
WINDOW_LEFT_MONITOR,
|
2009-08-02 04:42:34 +00:00
|
|
|
STARTUP_SEQUENCE_CHANGED,
|
2009-09-17 08:49:23 +00:00
|
|
|
WORKAREAS_CHANGED,
|
2013-03-14 20:55:49 +00:00
|
|
|
IN_FULLSCREEN_CHANGED,
|
2009-03-12 21:07:27 +00:00
|
|
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint screen_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
2008-11-17 20:56:34 +00:00
|
|
|
G_DEFINE_TYPE (MetaScreen, meta_screen, G_TYPE_OBJECT);
|
|
|
|
|
2016-12-02 14:09:43 +00:00
|
|
|
static GQuark quark_screen_x11_logical_monitor_data = 0;
|
|
|
|
|
|
|
|
typedef struct _MetaScreenX11LogicalMonitorData
|
|
|
|
{
|
|
|
|
int xinerama_index;
|
|
|
|
} MetaScreenX11LogicalMonitorData;
|
|
|
|
|
2008-11-17 22:22:28 +00:00
|
|
|
static void
|
|
|
|
meta_screen_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
MetaScreen *screen = META_SCREEN (object);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_screen_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
MetaScreen *screen = META_SCREEN (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_N_WORKSPACES:
|
|
|
|
g_value_set_int (value, meta_screen_get_n_workspaces (screen));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-17 20:56:34 +00:00
|
|
|
static void
|
|
|
|
meta_screen_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
/* Actual freeing done in meta_screen_free() for now */
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_screen_class_init (MetaScreenClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2008-11-17 22:22:28 +00:00
|
|
|
GParamSpec *pspec;
|
2008-11-17 20:56:34 +00:00
|
|
|
|
2008-11-17 22:22:28 +00:00
|
|
|
object_class->get_property = meta_screen_get_property;
|
|
|
|
object_class->set_property = meta_screen_set_property;
|
2008-11-17 20:56:34 +00:00
|
|
|
object_class->finalize = meta_screen_finalize;
|
2008-11-17 22:22:28 +00:00
|
|
|
|
|
|
|
pspec = g_param_spec_int ("n-workspaces",
|
|
|
|
"N Workspaces",
|
|
|
|
"Number of workspaces",
|
|
|
|
1, G_MAXINT, 1,
|
|
|
|
G_PARAM_READABLE);
|
|
|
|
|
2009-07-02 15:19:02 +00:00
|
|
|
screen_signals[WORKSPACE_ADDED] =
|
|
|
|
g_signal_new ("workspace-added",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
2011-10-18 22:06:14 +00:00
|
|
|
NULL, NULL, NULL,
|
2009-07-02 15:19:02 +00:00
|
|
|
G_TYPE_NONE,
|
|
|
|
1,
|
|
|
|
G_TYPE_INT);
|
|
|
|
|
|
|
|
screen_signals[WORKSPACE_REMOVED] =
|
|
|
|
g_signal_new ("workspace-removed",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
2011-10-18 22:06:14 +00:00
|
|
|
NULL, NULL, NULL,
|
2009-07-02 15:19:02 +00:00
|
|
|
G_TYPE_NONE,
|
|
|
|
1,
|
|
|
|
G_TYPE_INT);
|
|
|
|
|
|
|
|
screen_signals[WORKSPACE_SWITCHED] =
|
|
|
|
g_signal_new ("workspace-switched",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
2011-10-18 22:06:14 +00:00
|
|
|
NULL, NULL, NULL,
|
2009-07-02 15:19:02 +00:00
|
|
|
G_TYPE_NONE,
|
|
|
|
3,
|
|
|
|
G_TYPE_INT,
|
|
|
|
G_TYPE_INT,
|
2012-02-23 19:39:58 +00:00
|
|
|
META_TYPE_MOTION_DIRECTION);
|
2009-07-02 15:19:02 +00:00
|
|
|
|
2011-02-28 20:26:11 +00:00
|
|
|
screen_signals[WINDOW_ENTERED_MONITOR] =
|
|
|
|
g_signal_new ("window-entered-monitor",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
2011-10-18 22:06:14 +00:00
|
|
|
NULL, NULL, NULL,
|
2011-02-28 20:26:11 +00:00
|
|
|
G_TYPE_NONE, 2,
|
|
|
|
G_TYPE_INT,
|
|
|
|
META_TYPE_WINDOW);
|
|
|
|
|
|
|
|
screen_signals[WINDOW_LEFT_MONITOR] =
|
|
|
|
g_signal_new ("window-left-monitor",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
2011-10-18 22:06:14 +00:00
|
|
|
NULL, NULL, NULL,
|
2011-02-28 20:26:11 +00:00
|
|
|
G_TYPE_NONE, 2,
|
|
|
|
G_TYPE_INT,
|
|
|
|
META_TYPE_WINDOW);
|
|
|
|
|
2009-08-02 04:42:34 +00:00
|
|
|
screen_signals[STARTUP_SEQUENCE_CHANGED] =
|
|
|
|
g_signal_new ("startup-sequence-changed",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
2011-10-18 22:06:14 +00:00
|
|
|
NULL, NULL, NULL,
|
2009-08-02 04:42:34 +00:00
|
|
|
G_TYPE_NONE, 1, G_TYPE_POINTER);
|
|
|
|
|
2009-09-17 08:49:23 +00:00
|
|
|
screen_signals[WORKAREAS_CHANGED] =
|
|
|
|
g_signal_new ("workareas-changed",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (MetaScreenClass, workareas_changed),
|
2011-10-18 22:06:14 +00:00
|
|
|
NULL, NULL, NULL,
|
2009-09-17 08:49:23 +00:00
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
2013-03-14 20:55:49 +00:00
|
|
|
screen_signals[IN_FULLSCREEN_CHANGED] =
|
|
|
|
g_signal_new ("in-fullscreen-changed",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
|
|
|
NULL, NULL, NULL,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
2008-11-17 22:22:28 +00:00
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_N_WORKSPACES,
|
|
|
|
pspec);
|
2016-12-02 14:09:43 +00:00
|
|
|
|
|
|
|
quark_screen_x11_logical_monitor_data =
|
|
|
|
g_quark_from_static_string ("-meta-screen-logical-monitor-x11-data");
|
2008-11-17 20:56:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_screen_init (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-12-02 14:09:43 +00:00
|
|
|
static MetaScreenX11LogicalMonitorData *
|
|
|
|
get_screen_x11_logical_monitor_data (MetaLogicalMonitor *logical_monitor)
|
|
|
|
{
|
|
|
|
return g_object_get_qdata (G_OBJECT (logical_monitor),
|
|
|
|
quark_screen_x11_logical_monitor_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static MetaScreenX11LogicalMonitorData *
|
|
|
|
ensure_screen_x11_logical_monitor_data (MetaLogicalMonitor *logical_monitor)
|
|
|
|
{
|
|
|
|
MetaScreenX11LogicalMonitorData *data;
|
|
|
|
|
|
|
|
data = get_screen_x11_logical_monitor_data (logical_monitor);
|
|
|
|
if (data)
|
|
|
|
return data;
|
|
|
|
|
|
|
|
data = g_new0 (MetaScreenX11LogicalMonitorData, 1);
|
|
|
|
g_object_set_qdata_full (G_OBJECT (logical_monitor),
|
|
|
|
quark_screen_x11_logical_monitor_data,
|
|
|
|
data,
|
|
|
|
g_free);
|
|
|
|
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
2011-05-03 17:04:01 +00:00
|
|
|
static void
|
2013-07-18 11:09:16 +00:00
|
|
|
meta_screen_ensure_xinerama_indices (MetaScreen *screen)
|
2011-05-03 17:04:01 +00:00
|
|
|
{
|
2016-11-28 12:11:24 +00:00
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
2016-12-02 08:00:03 +00:00
|
|
|
GList *logical_monitors, *l;
|
2013-07-18 11:09:16 +00:00
|
|
|
XineramaScreenInfo *infos;
|
2016-11-28 12:11:24 +00:00
|
|
|
int n_infos, j;
|
2011-05-03 17:04:01 +00:00
|
|
|
|
2013-07-18 11:09:16 +00:00
|
|
|
if (screen->has_xinerama_indices)
|
|
|
|
return;
|
2011-05-03 17:04:01 +00:00
|
|
|
|
2013-07-18 11:09:16 +00:00
|
|
|
screen->has_xinerama_indices = TRUE;
|
2011-05-03 17:04:01 +00:00
|
|
|
|
2017-08-26 16:26:30 +00:00
|
|
|
if (!XineramaIsActive (screen->display->x11_display->xdisplay))
|
2013-07-18 11:09:16 +00:00
|
|
|
return;
|
|
|
|
|
2017-08-26 16:26:30 +00:00
|
|
|
infos = XineramaQueryScreens (screen->display->x11_display->xdisplay,
|
|
|
|
&n_infos);
|
2013-07-18 11:09:16 +00:00
|
|
|
if (n_infos <= 0 || infos == NULL)
|
2011-05-03 17:04:01 +00:00
|
|
|
{
|
2013-07-18 11:09:16 +00:00
|
|
|
meta_XFree (infos);
|
|
|
|
return;
|
|
|
|
}
|
2011-05-03 17:04:01 +00:00
|
|
|
|
2016-11-28 12:11:24 +00:00
|
|
|
logical_monitors =
|
2016-12-02 08:00:03 +00:00
|
|
|
meta_monitor_manager_get_logical_monitors (monitor_manager);
|
2016-11-28 12:11:24 +00:00
|
|
|
|
2016-12-02 08:00:03 +00:00
|
|
|
for (l = logical_monitors; l; l = l->next)
|
2013-07-18 11:09:16 +00:00
|
|
|
{
|
2016-12-02 08:00:03 +00:00
|
|
|
MetaLogicalMonitor *logical_monitor = l->data;
|
|
|
|
|
2013-07-18 11:09:16 +00:00
|
|
|
for (j = 0; j < n_infos; ++j)
|
2011-05-03 17:04:01 +00:00
|
|
|
{
|
2016-12-02 08:00:03 +00:00
|
|
|
if (logical_monitor->rect.x == infos[j].x_org &&
|
|
|
|
logical_monitor->rect.y == infos[j].y_org &&
|
|
|
|
logical_monitor->rect.width == infos[j].width &&
|
|
|
|
logical_monitor->rect.height == infos[j].height)
|
2016-12-02 14:09:43 +00:00
|
|
|
{
|
|
|
|
MetaScreenX11LogicalMonitorData *logical_monitor_data;
|
|
|
|
|
|
|
|
logical_monitor_data =
|
|
|
|
ensure_screen_x11_logical_monitor_data (logical_monitor);
|
|
|
|
logical_monitor_data->xinerama_index = j;
|
|
|
|
}
|
2011-05-03 17:04:01 +00:00
|
|
|
}
|
|
|
|
}
|
2013-07-18 11:09:16 +00:00
|
|
|
|
|
|
|
meta_XFree (infos);
|
2011-05-03 17:04:01 +00:00
|
|
|
}
|
|
|
|
|
2013-07-18 11:09:16 +00:00
|
|
|
int
|
2016-11-29 09:50:17 +00:00
|
|
|
meta_screen_logical_monitor_to_xinerama_index (MetaScreen *screen,
|
|
|
|
MetaLogicalMonitor *logical_monitor)
|
2011-05-20 08:56:12 +00:00
|
|
|
{
|
2016-12-02 14:09:43 +00:00
|
|
|
MetaScreenX11LogicalMonitorData *logical_monitor_data;
|
|
|
|
|
2016-11-29 09:50:17 +00:00
|
|
|
g_return_val_if_fail (logical_monitor, -1);
|
2013-12-14 13:24:27 +00:00
|
|
|
|
2013-07-18 11:09:16 +00:00
|
|
|
meta_screen_ensure_xinerama_indices (screen);
|
2011-05-20 08:56:12 +00:00
|
|
|
|
2016-12-02 14:09:43 +00:00
|
|
|
logical_monitor_data = get_screen_x11_logical_monitor_data (logical_monitor);
|
|
|
|
|
|
|
|
return logical_monitor_data->xinerama_index;
|
2011-05-20 08:56:12 +00:00
|
|
|
}
|
|
|
|
|
2016-11-29 09:50:17 +00:00
|
|
|
MetaLogicalMonitor *
|
|
|
|
meta_screen_xinerama_index_to_logical_monitor (MetaScreen *screen,
|
|
|
|
int xinerama_index)
|
2011-05-20 08:56:12 +00:00
|
|
|
{
|
2016-11-28 12:11:24 +00:00
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
2016-12-02 08:00:03 +00:00
|
|
|
GList *logical_monitors, *l;
|
2011-05-20 08:56:12 +00:00
|
|
|
|
2013-07-18 11:09:16 +00:00
|
|
|
meta_screen_ensure_xinerama_indices (screen);
|
2011-05-20 08:56:12 +00:00
|
|
|
|
2016-11-28 12:11:24 +00:00
|
|
|
logical_monitors =
|
2016-12-02 08:00:03 +00:00
|
|
|
meta_monitor_manager_get_logical_monitors (monitor_manager);
|
|
|
|
|
|
|
|
for (l = logical_monitors; l; l = l->next)
|
|
|
|
{
|
|
|
|
MetaLogicalMonitor *logical_monitor = l->data;
|
2016-12-02 14:09:43 +00:00
|
|
|
MetaScreenX11LogicalMonitorData *logical_monitor_data;
|
|
|
|
|
|
|
|
logical_monitor_data =
|
|
|
|
ensure_screen_x11_logical_monitor_data (logical_monitor);
|
2016-11-28 12:11:24 +00:00
|
|
|
|
2016-12-02 14:09:43 +00:00
|
|
|
if (logical_monitor_data->xinerama_index == xinerama_index)
|
2016-12-02 08:00:03 +00:00
|
|
|
return logical_monitor;
|
|
|
|
}
|
2011-05-20 08:56:12 +00:00
|
|
|
|
2016-11-29 09:50:17 +00:00
|
|
|
return NULL;
|
2011-05-20 08:56:12 +00:00
|
|
|
}
|
|
|
|
|
2002-09-29 02:50:24 +00:00
|
|
|
static void
|
2016-11-25 06:31:38 +00:00
|
|
|
reload_logical_monitors (MetaScreen *screen)
|
2002-09-29 02:50:24 +00:00
|
|
|
{
|
2014-08-15 23:49:49 +00:00
|
|
|
GList *l;
|
2011-05-20 08:56:12 +00:00
|
|
|
|
2014-08-15 23:49:49 +00:00
|
|
|
for (l = screen->workspaces; l != NULL; l = l->next)
|
2002-09-29 02:50:24 +00:00
|
|
|
{
|
2014-08-15 23:49:49 +00:00
|
|
|
MetaWorkspace *space = l->data;
|
2013-07-18 11:09:16 +00:00
|
|
|
meta_workspace_invalidate_work_area (space);
|
2002-09-29 02:50:24 +00:00
|
|
|
}
|
|
|
|
|
2013-07-18 11:09:16 +00:00
|
|
|
screen->has_xinerama_indices = FALSE;
|
2002-09-29 02:50:24 +00:00
|
|
|
}
|
|
|
|
|
2001-05-30 15:36:31 +00:00
|
|
|
MetaScreen*
|
|
|
|
meta_screen_new (MetaDisplay *display,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 16:32:33 +00:00
|
|
|
guint32 timestamp)
|
2001-05-30 15:36:31 +00:00
|
|
|
{
|
|
|
|
MetaScreen *screen;
|
2016-07-21 13:03:56 +00:00
|
|
|
int number;
|
2017-08-26 16:26:30 +00:00
|
|
|
Window xroot = meta_x11_display_get_xroot (display->x11_display);
|
|
|
|
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2016-07-21 13:03:56 +00:00
|
|
|
number = meta_ui_get_screen_number ();
|
|
|
|
|
2001-05-31 03:30:58 +00:00
|
|
|
meta_verbose ("Trying screen %d on display '%s'\n",
|
2017-08-26 16:26:30 +00:00
|
|
|
number, display->x11_display->name);
|
2001-05-31 03:30:58 +00:00
|
|
|
|
2008-11-17 20:56:34 +00:00
|
|
|
screen = g_object_new (META_TYPE_SCREEN, NULL);
|
2002-06-22 05:11:04 +00:00
|
|
|
screen->closing = 0;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-05-31 06:42:58 +00:00
|
|
|
screen->display = display;
|
2002-04-21 19:35:02 +00:00
|
|
|
|
2009-09-25 19:47:22 +00:00
|
|
|
screen->work_area_later = 0;
|
2013-03-14 20:55:49 +00:00
|
|
|
screen->check_fullscreen_later = 0;
|
2002-05-16 04:03:36 +00:00
|
|
|
|
2002-08-04 20:17:37 +00:00
|
|
|
screen->active_workspace = NULL;
|
2002-10-16 20:12:24 +00:00
|
|
|
screen->workspaces = NULL;
|
2002-05-16 04:03:36 +00:00
|
|
|
screen->rows_of_workspaces = 1;
|
|
|
|
screen->columns_of_workspaces = -1;
|
|
|
|
screen->vertical_workspaces = FALSE;
|
2002-10-01 19:57:26 +00:00
|
|
|
screen->starting_corner = META_SCREEN_TOPLEFT;
|
2002-09-29 02:50:24 +00:00
|
|
|
|
2016-11-25 06:31:38 +00:00
|
|
|
reload_logical_monitors (screen);
|
2013-08-13 10:57:41 +00:00
|
|
|
|
2002-05-16 04:03:36 +00:00
|
|
|
meta_screen_update_workspace_layout (screen);
|
2002-11-21 04:48:53 +00:00
|
|
|
|
2001-06-06 04:47:37 +00:00
|
|
|
/* Screens must have at least one workspace at all times,
|
|
|
|
* so create that required workspace.
|
|
|
|
*/
|
2014-06-05 20:28:56 +00:00
|
|
|
meta_workspace_new (screen);
|
2003-02-14 07:03:46 +00:00
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
screen->keys_grabbed = FALSE;
|
2001-06-06 04:47:37 +00:00
|
|
|
meta_screen_grab_keys (screen);
|
2001-06-18 03:24:25 +00:00
|
|
|
|
2017-08-26 16:26:30 +00:00
|
|
|
screen->ui = meta_ui_new (xdisplay);
|
2001-06-10 18:46:46 +00:00
|
|
|
|
2016-01-10 14:16:08 +00:00
|
|
|
screen->tile_preview_timeout_id = 0;
|
|
|
|
|
2001-12-10 03:55:26 +00:00
|
|
|
meta_prefs_add_listener (prefs_changed_callback, screen);
|
2002-10-25 23:35:50 +00:00
|
|
|
|
2001-06-03 01:33:27 +00:00
|
|
|
meta_verbose ("Added screen %d ('%s') root 0x%lx\n",
|
2017-08-26 16:26:30 +00:00
|
|
|
number, display->x11_display->screen_name,
|
|
|
|
xroot);
|
2013-07-18 11:09:16 +00:00
|
|
|
|
2001-05-30 15:36:31 +00:00
|
|
|
return screen;
|
|
|
|
}
|
|
|
|
|
2014-06-05 20:28:56 +00:00
|
|
|
void
|
|
|
|
meta_screen_init_workspaces (MetaScreen *screen)
|
|
|
|
{
|
2017-08-26 16:26:30 +00:00
|
|
|
MetaDisplay *display = screen->display;
|
2014-06-05 20:28:56 +00:00
|
|
|
MetaWorkspace *current_workspace;
|
2015-06-23 22:32:07 +00:00
|
|
|
uint32_t current_workspace_index = 0;
|
2014-06-05 20:28:56 +00:00
|
|
|
guint32 timestamp;
|
|
|
|
|
|
|
|
g_return_if_fail (META_IS_SCREEN (screen));
|
|
|
|
|
2017-08-26 18:51:28 +00:00
|
|
|
timestamp = screen->display->x11_display->wm_sn_timestamp;
|
2014-06-05 20:28:56 +00:00
|
|
|
|
|
|
|
/* Get current workspace */
|
2017-08-26 18:51:28 +00:00
|
|
|
if (meta_prop_get_cardinal (display->x11_display,
|
2017-08-26 16:26:30 +00:00
|
|
|
display->x11_display->xroot,
|
|
|
|
display->x11_display->atom__NET_CURRENT_DESKTOP,
|
2014-06-05 20:28:56 +00:00
|
|
|
¤t_workspace_index))
|
|
|
|
meta_verbose ("Read existing _NET_CURRENT_DESKTOP = %d\n",
|
|
|
|
(int) current_workspace_index);
|
|
|
|
else
|
|
|
|
meta_verbose ("No _NET_CURRENT_DESKTOP present\n");
|
|
|
|
|
|
|
|
update_num_workspaces (screen, timestamp);
|
|
|
|
|
|
|
|
set_workspace_names (screen);
|
|
|
|
|
|
|
|
/* Switch to the _NET_CURRENT_DESKTOP workspace */
|
|
|
|
current_workspace = meta_screen_get_workspace_by_index (screen,
|
|
|
|
current_workspace_index);
|
|
|
|
|
|
|
|
if (current_workspace != NULL)
|
|
|
|
meta_workspace_activate (current_workspace, timestamp);
|
2014-07-10 15:24:32 +00:00
|
|
|
else
|
|
|
|
meta_workspace_activate (screen->workspaces->data, timestamp);
|
2014-06-05 20:28:56 +00:00
|
|
|
}
|
|
|
|
|
2001-05-30 15:36:31 +00:00
|
|
|
void
|
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 17:27:24 +00:00
|
|
|
meta_screen_free (MetaScreen *screen,
|
|
|
|
guint32 timestamp)
|
2002-06-08 23:55:27 +00:00
|
|
|
{
|
2002-06-22 05:11:04 +00:00
|
|
|
screen->closing += 1;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-12-10 03:55:26 +00:00
|
|
|
meta_prefs_remove_listener (prefs_changed_callback, screen);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-06-06 04:47:37 +00:00
|
|
|
meta_screen_ungrab_keys (screen);
|
2001-08-19 18:09:10 +00:00
|
|
|
|
2001-06-18 06:11:53 +00:00
|
|
|
meta_ui_free (screen->ui);
|
2001-06-03 21:39:57 +00:00
|
|
|
|
2009-09-25 19:47:22 +00:00
|
|
|
if (screen->work_area_later != 0)
|
2013-11-09 16:06:53 +00:00
|
|
|
meta_later_remove (screen->work_area_later);
|
2013-03-14 20:55:49 +00:00
|
|
|
if (screen->check_fullscreen_later != 0)
|
2013-11-09 16:06:53 +00:00
|
|
|
meta_later_remove (screen->check_fullscreen_later);
|
2003-10-12 06:25:38 +00:00
|
|
|
|
2016-01-10 14:16:08 +00:00
|
|
|
if (screen->tile_preview_timeout_id)
|
|
|
|
g_source_remove (screen->tile_preview_timeout_id);
|
2010-06-24 18:41:28 +00:00
|
|
|
|
2008-11-17 20:56:34 +00:00
|
|
|
g_object_unref (screen);
|
2001-05-30 15:36:31 +00:00
|
|
|
}
|
|
|
|
|
2001-12-10 03:55:26 +00:00
|
|
|
static void
|
|
|
|
prefs_changed_callback (MetaPreference pref,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
MetaScreen *screen = data;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2012-03-08 00:29:58 +00:00
|
|
|
if ((pref == META_PREF_NUM_WORKSPACES ||
|
|
|
|
pref == META_PREF_DYNAMIC_WORKSPACES) &&
|
|
|
|
!meta_prefs_get_dynamic_workspaces ())
|
2001-12-10 03:55:26 +00:00
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
/* GSettings doesn't provide timestamps, but luckily update_num_workspaces
|
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 17:27:24 +00:00
|
|
|
* often doesn't need it...
|
|
|
|
*/
|
2014-05-02 13:34:02 +00:00
|
|
|
guint32 timestamp =
|
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 17:27:24 +00:00
|
|
|
meta_display_get_current_time_roundtrip (screen->display);
|
|
|
|
update_num_workspaces (screen, timestamp);
|
2001-12-10 03:55:26 +00:00
|
|
|
}
|
2002-11-03 19:06:39 +00:00
|
|
|
else if (pref == META_PREF_WORKSPACE_NAMES)
|
|
|
|
{
|
2003-02-14 07:03:46 +00:00
|
|
|
set_workspace_names (screen);
|
2002-11-03 19:06:39 +00:00
|
|
|
}
|
2001-12-10 03:55:26 +00:00
|
|
|
}
|
|
|
|
|
2001-06-09 05:14:43 +00:00
|
|
|
int
|
|
|
|
meta_screen_get_n_workspaces (MetaScreen *screen)
|
2002-10-16 20:12:24 +00:00
|
|
|
{
|
|
|
|
return g_list_length (screen->workspaces);
|
|
|
|
}
|
|
|
|
|
2008-11-17 21:34:28 +00:00
|
|
|
/**
|
|
|
|
* meta_screen_get_workspace_by_index:
|
|
|
|
* @screen: a #MetaScreen
|
|
|
|
* @index: index of one of the screen's workspaces
|
|
|
|
*
|
|
|
|
* Gets the workspace object for one of a screen's workspaces given the workspace
|
|
|
|
* index. It's valid to call this function with an out-of-range index and it
|
|
|
|
* will robustly return %NULL.
|
|
|
|
*
|
|
|
|
* Return value: (transfer none): the workspace object with specified index, or %NULL
|
|
|
|
* if the index is out of range.
|
|
|
|
*/
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaWorkspace*
|
|
|
|
meta_screen_get_workspace_by_index (MetaScreen *screen,
|
|
|
|
int idx)
|
2001-06-09 05:14:43 +00:00
|
|
|
{
|
2014-08-15 23:41:37 +00:00
|
|
|
return g_list_nth_data (screen->workspaces, idx);
|
2001-12-10 03:55:26 +00:00
|
|
|
}
|
2001-06-09 05:14:43 +00:00
|
|
|
|
2002-10-21 21:44:35 +00:00
|
|
|
static void
|
2002-08-14 00:08:30 +00:00
|
|
|
set_number_of_spaces_hint (MetaScreen *screen,
|
|
|
|
int n_spaces)
|
|
|
|
{
|
2017-08-26 16:26:30 +00:00
|
|
|
MetaX11Display *x11_display = screen->display->x11_display;
|
2002-08-14 00:08:30 +00:00
|
|
|
unsigned long data[1];
|
|
|
|
|
|
|
|
if (screen->closing > 0)
|
2002-10-21 21:44:35 +00:00
|
|
|
return;
|
2002-08-14 00:08:30 +00:00
|
|
|
|
|
|
|
data[0] = n_spaces;
|
|
|
|
|
2006-01-20 22:03:56 +00:00
|
|
|
meta_verbose ("Setting _NET_NUMBER_OF_DESKTOPS to %lu\n", data[0]);
|
2002-08-14 00:08:30 +00:00
|
|
|
|
2017-08-26 16:27:50 +00:00
|
|
|
meta_error_trap_push (x11_display);
|
2017-08-26 16:26:30 +00:00
|
|
|
XChangeProperty (x11_display->xdisplay,
|
|
|
|
x11_display->xroot,
|
|
|
|
x11_display->atom__NET_NUMBER_OF_DESKTOPS,
|
2002-08-14 00:08:30 +00:00
|
|
|
XA_CARDINAL,
|
|
|
|
32, PropModeReplace, (guchar*) data, 1);
|
2017-08-26 16:27:50 +00:00
|
|
|
meta_error_trap_pop (x11_display);
|
2002-08-14 00:08:30 +00:00
|
|
|
}
|
|
|
|
|
2008-10-24 10:03:43 +00:00
|
|
|
void
|
|
|
|
meta_screen_remove_workspace (MetaScreen *screen, MetaWorkspace *workspace,
|
|
|
|
guint32 timestamp)
|
|
|
|
{
|
|
|
|
GList *l;
|
2014-08-16 18:49:18 +00:00
|
|
|
GList *next;
|
2008-10-24 10:03:43 +00:00
|
|
|
MetaWorkspace *neighbour = NULL;
|
2010-02-11 10:06:38 +00:00
|
|
|
int index;
|
2011-01-25 21:27:31 +00:00
|
|
|
gboolean active_index_changed;
|
2010-02-11 10:06:38 +00:00
|
|
|
int new_num;
|
2008-10-24 10:03:43 +00:00
|
|
|
|
2014-08-16 18:49:18 +00:00
|
|
|
l = g_list_find (screen->workspaces, workspace);
|
|
|
|
if (!l)
|
|
|
|
return;
|
2008-10-24 10:03:43 +00:00
|
|
|
|
2014-08-16 18:49:18 +00:00
|
|
|
next = l->next;
|
2008-10-24 10:03:43 +00:00
|
|
|
|
2014-08-16 18:49:18 +00:00
|
|
|
if (l->prev)
|
|
|
|
neighbour = l->prev->data;
|
|
|
|
else if (l->next)
|
|
|
|
neighbour = l->next->data;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Cannot remove the only workspace! */
|
|
|
|
return;
|
|
|
|
}
|
2009-01-20 12:48:59 +00:00
|
|
|
|
2008-10-24 10:03:43 +00:00
|
|
|
meta_workspace_relocate_windows (workspace, neighbour);
|
|
|
|
|
|
|
|
if (workspace == screen->active_workspace)
|
|
|
|
meta_workspace_activate (neighbour, timestamp);
|
|
|
|
|
2009-07-02 15:19:02 +00:00
|
|
|
/* To emit the signal after removing the workspace */
|
|
|
|
index = meta_workspace_index (workspace);
|
2011-01-25 21:27:31 +00:00
|
|
|
active_index_changed = index < meta_screen_get_active_workspace_index (screen);
|
2009-07-02 15:19:02 +00:00
|
|
|
|
2008-10-24 10:03:43 +00:00
|
|
|
/* This also removes the workspace from the screens list */
|
2008-11-17 20:56:34 +00:00
|
|
|
meta_workspace_remove (workspace);
|
2008-10-24 10:03:43 +00:00
|
|
|
|
2010-02-11 10:06:38 +00:00
|
|
|
new_num = g_list_length (screen->workspaces);
|
|
|
|
|
|
|
|
set_number_of_spaces_hint (screen, new_num);
|
2012-03-08 00:29:58 +00:00
|
|
|
|
|
|
|
if (!meta_prefs_get_dynamic_workspaces ())
|
|
|
|
meta_prefs_set_num_workspaces (new_num);
|
2008-10-24 10:03:43 +00:00
|
|
|
|
2011-01-25 21:27:31 +00:00
|
|
|
/* If deleting a workspace before the current workspace, the active
|
|
|
|
* workspace index changes, so we need to update that hint */
|
|
|
|
if (active_index_changed)
|
2012-03-07 21:32:34 +00:00
|
|
|
meta_screen_set_active_workspace_hint (screen);
|
2011-01-25 21:27:31 +00:00
|
|
|
|
2014-08-15 23:49:49 +00:00
|
|
|
for (l = next; l != NULL; l = l->next)
|
2009-01-09 15:04:53 +00:00
|
|
|
{
|
|
|
|
MetaWorkspace *w = l->data;
|
2014-08-16 12:03:10 +00:00
|
|
|
meta_workspace_index_changed (w);
|
2009-01-09 15:04:53 +00:00
|
|
|
}
|
|
|
|
|
2008-10-24 10:03:43 +00:00
|
|
|
meta_screen_queue_workarea_recalc (screen);
|
2008-11-17 22:22:28 +00:00
|
|
|
|
2009-07-02 15:19:02 +00:00
|
|
|
g_signal_emit (screen, screen_signals[WORKSPACE_REMOVED], 0, index);
|
2008-11-17 22:22:28 +00:00
|
|
|
g_object_notify (G_OBJECT (screen), "n-workspaces");
|
2008-10-24 10:03:43 +00:00
|
|
|
}
|
|
|
|
|
2008-11-17 21:34:28 +00:00
|
|
|
/**
|
|
|
|
* meta_screen_append_new_workspace:
|
|
|
|
* @screen: a #MetaScreen
|
|
|
|
* @activate: %TRUE if the workspace should be switched to after creation
|
|
|
|
* @timestamp: if switching to a new workspace, timestamp to be used when
|
|
|
|
* focusing a window on the new workspace. (Doesn't hurt to pass a valid
|
|
|
|
* timestamp when available even if not switching workspaces.)
|
|
|
|
*
|
|
|
|
* Append a new workspace to the screen and (optionally) switch to that
|
|
|
|
* screen.
|
|
|
|
*
|
|
|
|
* Return value: (transfer none): the newly appended workspace.
|
|
|
|
*/
|
2008-10-24 10:11:28 +00:00
|
|
|
MetaWorkspace *
|
|
|
|
meta_screen_append_new_workspace (MetaScreen *screen, gboolean activate,
|
|
|
|
guint32 timestamp)
|
|
|
|
{
|
|
|
|
MetaWorkspace *w;
|
2010-02-11 10:06:38 +00:00
|
|
|
int new_num;
|
2008-10-24 10:11:28 +00:00
|
|
|
|
|
|
|
/* This also adds the workspace to the screen list */
|
|
|
|
w = meta_workspace_new (screen);
|
|
|
|
|
|
|
|
if (!w)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (activate)
|
|
|
|
meta_workspace_activate (w, timestamp);
|
|
|
|
|
2010-02-11 10:06:38 +00:00
|
|
|
new_num = g_list_length (screen->workspaces);
|
|
|
|
|
|
|
|
set_number_of_spaces_hint (screen, new_num);
|
2012-03-08 00:29:58 +00:00
|
|
|
|
|
|
|
if (!meta_prefs_get_dynamic_workspaces ())
|
|
|
|
meta_prefs_set_num_workspaces (new_num);
|
2008-10-24 10:11:28 +00:00
|
|
|
|
|
|
|
meta_screen_queue_workarea_recalc (screen);
|
|
|
|
|
2009-07-02 15:19:02 +00:00
|
|
|
g_signal_emit (screen, screen_signals[WORKSPACE_ADDED],
|
|
|
|
0, meta_workspace_index (w));
|
2008-11-17 22:22:28 +00:00
|
|
|
g_object_notify (G_OBJECT (screen), "n-workspaces");
|
|
|
|
|
2008-10-24 10:11:28 +00:00
|
|
|
return w;
|
|
|
|
}
|
|
|
|
|
2008-10-24 10:03:43 +00:00
|
|
|
|
2001-12-10 03:55:26 +00:00
|
|
|
static void
|
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 17:27:24 +00:00
|
|
|
update_num_workspaces (MetaScreen *screen,
|
|
|
|
guint32 timestamp)
|
2001-12-10 03:55:26 +00:00
|
|
|
{
|
2017-08-26 16:26:30 +00:00
|
|
|
MetaDisplay *display = screen->display;
|
2011-12-06 15:41:27 +00:00
|
|
|
int new_num, old_num;
|
2014-08-15 23:49:49 +00:00
|
|
|
GList *l;
|
2001-12-10 03:55:26 +00:00
|
|
|
int i;
|
|
|
|
GList *extras;
|
|
|
|
MetaWorkspace *last_remaining;
|
|
|
|
gboolean need_change_space;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2012-10-17 18:15:10 +00:00
|
|
|
if (meta_prefs_get_dynamic_workspaces ())
|
|
|
|
{
|
|
|
|
int n_items;
|
2015-06-23 22:09:07 +00:00
|
|
|
uint32_t *list;
|
2012-10-17 18:15:10 +00:00
|
|
|
|
|
|
|
n_items = 0;
|
|
|
|
list = NULL;
|
|
|
|
|
2017-08-26 18:51:28 +00:00
|
|
|
if (meta_prop_get_cardinal_list (display->x11_display,
|
2017-08-26 16:26:30 +00:00
|
|
|
display->x11_display->xroot,
|
|
|
|
display->x11_display->atom__NET_NUMBER_OF_DESKTOPS,
|
2012-10-17 18:15:10 +00:00
|
|
|
&list, &n_items))
|
|
|
|
{
|
|
|
|
new_num = list[0];
|
|
|
|
meta_XFree (list);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
new_num = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
new_num = meta_prefs_get_num_workspaces ();
|
|
|
|
}
|
2001-12-10 03:55:26 +00:00
|
|
|
|
|
|
|
g_assert (new_num > 0);
|
|
|
|
|
2010-02-11 10:06:38 +00:00
|
|
|
if (g_list_length (screen->workspaces) == (guint) new_num)
|
2017-09-29 22:38:37 +00:00
|
|
|
{
|
|
|
|
if (screen->display->display_opening)
|
|
|
|
set_number_of_spaces_hint (screen, new_num);
|
|
|
|
return;
|
|
|
|
}
|
2010-02-11 10:06:38 +00:00
|
|
|
|
2001-12-10 03:55:26 +00:00
|
|
|
last_remaining = NULL;
|
|
|
|
extras = NULL;
|
|
|
|
i = 0;
|
2014-08-15 23:49:49 +00:00
|
|
|
for (l = screen->workspaces; l != NULL; l = l->next)
|
2001-12-10 03:55:26 +00:00
|
|
|
{
|
2014-08-15 23:49:49 +00:00
|
|
|
MetaWorkspace *w = l->data;
|
2001-12-10 03:55:26 +00:00
|
|
|
|
2003-01-08 04:23:18 +00:00
|
|
|
if (i >= new_num)
|
2002-10-16 20:12:24 +00:00
|
|
|
extras = g_list_prepend (extras, w);
|
|
|
|
else
|
|
|
|
last_remaining = w;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-16 20:12:24 +00:00
|
|
|
++i;
|
2001-12-10 03:55:26 +00:00
|
|
|
}
|
2011-12-06 15:41:27 +00:00
|
|
|
old_num = i;
|
2001-12-10 03:55:26 +00:00
|
|
|
|
|
|
|
g_assert (last_remaining);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-12-10 03:55:26 +00:00
|
|
|
/* Get rid of the extra workspaces by moving all their windows
|
|
|
|
* to last_remaining, then activating last_remaining if
|
|
|
|
* one of the removed workspaces was active. This will be a bit
|
|
|
|
* wacky if the config tool for changing number of workspaces
|
|
|
|
* is on a removed workspace ;-)
|
|
|
|
*/
|
|
|
|
need_change_space = FALSE;
|
2014-08-15 23:49:49 +00:00
|
|
|
for (l = extras; l != NULL; l = l->next)
|
2001-12-10 03:55:26 +00:00
|
|
|
{
|
2014-08-15 23:49:49 +00:00
|
|
|
MetaWorkspace *w = l->data;
|
2001-12-10 03:55:26 +00:00
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
meta_workspace_relocate_windows (w, last_remaining);
|
2001-12-10 03:55:26 +00:00
|
|
|
|
|
|
|
if (w == screen->active_workspace)
|
|
|
|
need_change_space = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (need_change_space)
|
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 17:27:24 +00:00
|
|
|
meta_workspace_activate (last_remaining, timestamp);
|
2001-12-10 03:55:26 +00:00
|
|
|
|
|
|
|
/* Should now be safe to free the workspaces */
|
2014-08-15 23:49:49 +00:00
|
|
|
for (l = extras; l != NULL; l = l->next)
|
2001-12-10 03:55:26 +00:00
|
|
|
{
|
2014-08-15 23:49:49 +00:00
|
|
|
MetaWorkspace *w = l->data;
|
2001-12-10 03:55:26 +00:00
|
|
|
|
2008-11-17 20:56:34 +00:00
|
|
|
meta_workspace_remove (w);
|
2001-12-10 03:55:26 +00:00
|
|
|
}
|
2011-12-06 15:41:27 +00:00
|
|
|
|
2001-12-10 03:55:26 +00:00
|
|
|
g_list_free (extras);
|
2011-12-06 15:41:27 +00:00
|
|
|
|
|
|
|
for (i = old_num; i < new_num; i++)
|
|
|
|
meta_workspace_new (screen);
|
2002-06-25 01:12:37 +00:00
|
|
|
|
2002-08-14 00:08:30 +00:00
|
|
|
set_number_of_spaces_hint (screen, new_num);
|
|
|
|
|
2002-06-25 01:12:37 +00:00
|
|
|
meta_screen_queue_workarea_recalc (screen);
|
2008-11-17 22:22:28 +00:00
|
|
|
|
2011-12-06 15:41:27 +00:00
|
|
|
for (i = old_num; i < new_num; i++)
|
|
|
|
g_signal_emit (screen, screen_signals[WORKSPACE_ADDED], 0, i);
|
|
|
|
|
2008-11-17 22:22:28 +00:00
|
|
|
g_object_notify (G_OBJECT (screen), "n-workspaces");
|
2001-06-09 05:14:43 +00:00
|
|
|
}
|
2001-07-26 03:14:45 +00:00
|
|
|
|
2010-06-24 18:41:28 +00:00
|
|
|
static gboolean
|
2012-03-24 10:29:39 +00:00
|
|
|
meta_screen_update_tile_preview_timeout (gpointer data)
|
2010-06-24 18:41:28 +00:00
|
|
|
{
|
2016-01-10 14:16:09 +00:00
|
|
|
MetaScreen *screen = data;
|
|
|
|
MetaWindow *window = screen->display->grab_window;
|
|
|
|
gboolean needs_preview = FALSE;
|
|
|
|
|
|
|
|
screen->tile_preview_timeout_id = 0;
|
|
|
|
|
|
|
|
if (window)
|
|
|
|
{
|
2017-09-27 12:53:54 +00:00
|
|
|
switch (screen->preview_tile_mode)
|
2016-01-10 14:16:09 +00:00
|
|
|
{
|
|
|
|
case META_TILE_LEFT:
|
|
|
|
case META_TILE_RIGHT:
|
|
|
|
if (!META_WINDOW_TILED_SIDE_BY_SIDE (window))
|
|
|
|
needs_preview = TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_TILE_MAXIMIZED:
|
|
|
|
if (!META_WINDOW_MAXIMIZED (window))
|
|
|
|
needs_preview = TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
needs_preview = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (needs_preview)
|
|
|
|
{
|
|
|
|
MetaRectangle tile_rect;
|
|
|
|
int monitor;
|
|
|
|
|
|
|
|
monitor = meta_window_get_current_tile_monitor_number (window);
|
2017-09-27 12:53:54 +00:00
|
|
|
meta_window_get_tile_area (window, screen->preview_tile_mode, &tile_rect);
|
2016-01-10 14:16:09 +00:00
|
|
|
meta_compositor_show_tile_preview (screen->display->compositor,
|
|
|
|
window, &tile_rect, monitor);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
meta_compositor_hide_tile_preview (screen->display->compositor);
|
|
|
|
|
2010-06-24 18:41:28 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define TILE_PREVIEW_TIMEOUT_MS 200
|
|
|
|
|
|
|
|
void
|
2016-01-10 14:16:08 +00:00
|
|
|
meta_screen_update_tile_preview (MetaScreen *screen,
|
|
|
|
gboolean delay)
|
2010-06-24 18:41:28 +00:00
|
|
|
{
|
|
|
|
if (delay)
|
|
|
|
{
|
2016-01-10 14:16:08 +00:00
|
|
|
if (screen->tile_preview_timeout_id > 0)
|
2010-06-24 18:41:28 +00:00
|
|
|
return;
|
|
|
|
|
2016-01-10 14:16:08 +00:00
|
|
|
screen->tile_preview_timeout_id =
|
2010-06-24 18:41:28 +00:00
|
|
|
g_timeout_add (TILE_PREVIEW_TIMEOUT_MS,
|
2012-03-24 10:29:39 +00:00
|
|
|
meta_screen_update_tile_preview_timeout,
|
2010-06-24 18:41:28 +00:00
|
|
|
screen);
|
2016-01-10 14:16:08 +00:00
|
|
|
g_source_set_name_by_id (screen->tile_preview_timeout_id,
|
2014-04-10 16:58:58 +00:00
|
|
|
"[mutter] meta_screen_update_tile_preview_timeout");
|
2010-06-24 18:41:28 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-01-10 14:16:08 +00:00
|
|
|
if (screen->tile_preview_timeout_id > 0)
|
|
|
|
g_source_remove (screen->tile_preview_timeout_id);
|
2010-06-24 18:41:28 +00:00
|
|
|
|
2016-01-10 14:16:08 +00:00
|
|
|
meta_screen_update_tile_preview_timeout ((gpointer)screen);
|
2010-06-24 18:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-19 21:38:51 +00:00
|
|
|
void
|
2012-03-24 10:29:39 +00:00
|
|
|
meta_screen_hide_tile_preview (MetaScreen *screen)
|
2011-01-19 21:38:51 +00:00
|
|
|
{
|
2016-01-10 14:16:08 +00:00
|
|
|
if (screen->tile_preview_timeout_id > 0)
|
|
|
|
g_source_remove (screen->tile_preview_timeout_id);
|
2017-09-28 13:09:31 +00:00
|
|
|
screen->tile_preview_timeout_id = 0;
|
2011-01-19 21:38:51 +00:00
|
|
|
|
2017-09-27 12:53:54 +00:00
|
|
|
screen->preview_tile_mode = META_TILE_NONE;
|
2016-01-10 14:16:08 +00:00
|
|
|
meta_compositor_hide_tile_preview (screen->display->compositor);
|
2011-01-19 21:38:51 +00:00
|
|
|
}
|
|
|
|
|
2004-06-24 20:02:46 +00:00
|
|
|
MetaWindow*
|
|
|
|
meta_screen_get_mouse_window (MetaScreen *screen,
|
|
|
|
MetaWindow *not_this_one)
|
2003-01-22 04:54:04 +00:00
|
|
|
{
|
2016-11-29 12:30:22 +00:00
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
|
2003-01-22 04:54:04 +00:00
|
|
|
MetaWindow *window;
|
2014-03-02 22:27:50 +00:00
|
|
|
int x, y;
|
2012-12-17 02:47:11 +00:00
|
|
|
|
2003-01-22 04:54:04 +00:00
|
|
|
if (not_this_one)
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focusing mouse window excluding %s\n", not_this_one->desc);
|
|
|
|
|
2016-11-29 12:30:22 +00:00
|
|
|
meta_cursor_tracker_get_pointer (cursor_tracker, &x, &y, NULL);
|
2003-01-22 04:54:04 +00:00
|
|
|
|
2017-08-26 17:03:51 +00:00
|
|
|
window = meta_stack_get_default_focus_window_at_point (screen->display->stack,
|
2003-01-22 04:54:04 +00:00
|
|
|
screen->active_workspace,
|
|
|
|
not_this_one,
|
2014-03-02 22:27:50 +00:00
|
|
|
x, y);
|
2003-01-22 04:54:04 +00:00
|
|
|
|
2004-06-24 20:02:46 +00:00
|
|
|
return window;
|
2003-01-22 04:54:04 +00:00
|
|
|
}
|
|
|
|
|
2013-01-28 04:39:12 +00:00
|
|
|
int
|
|
|
|
meta_screen_get_monitor_index_for_rect (MetaScreen *screen,
|
|
|
|
MetaRectangle *rect)
|
|
|
|
{
|
2016-12-01 04:52:07 +00:00
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
|
|
|
MetaLogicalMonitor *logical_monitor;
|
2016-11-25 06:31:38 +00:00
|
|
|
|
2016-12-01 04:52:07 +00:00
|
|
|
logical_monitor =
|
|
|
|
meta_monitor_manager_get_logical_monitor_from_rect (monitor_manager, rect);
|
2017-04-12 06:24:25 +00:00
|
|
|
if (!logical_monitor)
|
|
|
|
return -1;
|
|
|
|
|
2016-12-01 04:52:07 +00:00
|
|
|
return logical_monitor->number;
|
2013-01-28 04:39:12 +00:00
|
|
|
}
|
|
|
|
|
2015-03-22 13:41:54 +00:00
|
|
|
int
|
|
|
|
meta_screen_get_monitor_neighbor_index (MetaScreen *screen,
|
|
|
|
int which_monitor,
|
|
|
|
MetaScreenDirection direction)
|
|
|
|
{
|
2016-12-01 07:15:52 +00:00
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
2016-11-28 13:15:57 +00:00
|
|
|
MetaLogicalMonitor *logical_monitor;
|
2016-12-01 07:15:52 +00:00
|
|
|
MetaLogicalMonitor *neighbor;
|
2016-11-25 06:31:38 +00:00
|
|
|
|
2016-12-01 07:15:52 +00:00
|
|
|
logical_monitor =
|
|
|
|
meta_monitor_manager_get_logical_monitor_from_number (monitor_manager,
|
|
|
|
which_monitor);
|
|
|
|
neighbor = meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager,
|
|
|
|
logical_monitor,
|
|
|
|
direction);
|
|
|
|
return neighbor ? neighbor->number : -1;
|
2015-03-22 13:41:54 +00:00
|
|
|
}
|
|
|
|
|
2012-06-08 08:21:10 +00:00
|
|
|
/**
|
|
|
|
* meta_screen_get_current_monitor:
|
|
|
|
* @screen: a #MetaScreen
|
|
|
|
*
|
|
|
|
* Gets the index of the monitor that currently has the mouse pointer.
|
|
|
|
*
|
|
|
|
* Return value: a monitor index
|
|
|
|
*/
|
|
|
|
int
|
2009-08-31 13:52:16 +00:00
|
|
|
meta_screen_get_current_monitor (MetaScreen *screen)
|
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 05:41:13 +00:00
|
|
|
{
|
2016-11-28 12:11:24 +00:00
|
|
|
MetaBackend *backend = meta_get_backend ();
|
2016-12-01 04:59:47 +00:00
|
|
|
MetaLogicalMonitor *logical_monitor;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2016-12-01 04:59:47 +00:00
|
|
|
logical_monitor = meta_backend_get_current_logical_monitor (backend);
|
2014-03-02 22:27:50 +00:00
|
|
|
|
2016-12-01 04:59:47 +00:00
|
|
|
/* Pretend its the first when there is no actual current monitor. */
|
|
|
|
if (!logical_monitor)
|
|
|
|
return 0;
|
2002-06-07 03:18:46 +00:00
|
|
|
|
2016-12-01 04:59:47 +00:00
|
|
|
return logical_monitor->number;
|
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 05:41:13 +00:00
|
|
|
}
|
2002-05-16 04:03:36 +00:00
|
|
|
|
2009-08-31 14:06:17 +00:00
|
|
|
/**
|
|
|
|
* meta_screen_get_n_monitors:
|
|
|
|
* @screen: a #MetaScreen
|
|
|
|
*
|
|
|
|
* Gets the number of monitors that are joined together to form @screen.
|
|
|
|
*
|
|
|
|
* Return value: the number of monitors
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
meta_screen_get_n_monitors (MetaScreen *screen)
|
|
|
|
{
|
2016-11-28 12:11:24 +00:00
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
|
|
|
|
2009-08-31 14:06:17 +00:00
|
|
|
g_return_val_if_fail (META_IS_SCREEN (screen), 0);
|
|
|
|
|
2016-11-28 12:11:24 +00:00
|
|
|
return meta_monitor_manager_get_num_logical_monitors (monitor_manager);
|
2009-08-31 14:06:17 +00:00
|
|
|
}
|
|
|
|
|
2011-02-25 13:07:48 +00:00
|
|
|
/**
|
|
|
|
* meta_screen_get_primary_monitor:
|
|
|
|
* @screen: a #MetaScreen
|
|
|
|
*
|
|
|
|
* Gets the index of the primary monitor on this @screen.
|
|
|
|
*
|
|
|
|
* Return value: a monitor index
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
meta_screen_get_primary_monitor (MetaScreen *screen)
|
|
|
|
{
|
2016-11-28 12:11:24 +00:00
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
2016-11-28 12:43:27 +00:00
|
|
|
MetaLogicalMonitor *logical_monitor;
|
2016-11-28 12:11:24 +00:00
|
|
|
|
2011-02-25 13:07:48 +00:00
|
|
|
g_return_val_if_fail (META_IS_SCREEN (screen), 0);
|
|
|
|
|
2016-11-28 12:43:27 +00:00
|
|
|
logical_monitor =
|
|
|
|
meta_monitor_manager_get_primary_logical_monitor (monitor_manager);
|
|
|
|
if (logical_monitor)
|
|
|
|
return logical_monitor->number;
|
|
|
|
else
|
2017-04-12 06:24:25 +00:00
|
|
|
return -1;
|
2011-02-25 13:07:48 +00:00
|
|
|
}
|
|
|
|
|
2009-08-31 14:06:17 +00:00
|
|
|
/**
|
|
|
|
* meta_screen_get_monitor_geometry:
|
|
|
|
* @screen: a #MetaScreen
|
|
|
|
* @monitor: the monitor number
|
|
|
|
* @geometry: (out): location to store the monitor geometry
|
|
|
|
*
|
|
|
|
* Stores the location and size of the indicated monitor in @geometry.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
meta_screen_get_monitor_geometry (MetaScreen *screen,
|
|
|
|
int monitor,
|
|
|
|
MetaRectangle *geometry)
|
|
|
|
{
|
2016-11-28 12:11:24 +00:00
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
2016-12-02 08:00:03 +00:00
|
|
|
MetaLogicalMonitor *logical_monitor;
|
2016-11-28 12:11:24 +00:00
|
|
|
#ifndef G_DISABLE_CHECKS
|
|
|
|
int n_logical_monitors =
|
|
|
|
meta_monitor_manager_get_num_logical_monitors (monitor_manager);
|
|
|
|
#endif
|
|
|
|
|
2009-08-31 14:06:17 +00:00
|
|
|
g_return_if_fail (META_IS_SCREEN (screen));
|
2016-11-28 12:11:24 +00:00
|
|
|
g_return_if_fail (monitor >= 0 && monitor < n_logical_monitors);
|
2009-08-31 14:06:17 +00:00
|
|
|
g_return_if_fail (geometry != NULL);
|
|
|
|
|
2016-12-02 08:00:03 +00:00
|
|
|
logical_monitor =
|
|
|
|
meta_monitor_manager_get_logical_monitor_from_number (monitor_manager,
|
|
|
|
monitor);
|
|
|
|
*geometry = logical_monitor->rect;
|
2009-08-31 14:06:17 +00:00
|
|
|
}
|
|
|
|
|
2002-05-16 04:03:36 +00:00
|
|
|
#define _NET_WM_ORIENTATION_HORZ 0
|
|
|
|
#define _NET_WM_ORIENTATION_VERT 1
|
|
|
|
|
2002-10-01 19:57:26 +00:00
|
|
|
#define _NET_WM_TOPLEFT 0
|
|
|
|
#define _NET_WM_TOPRIGHT 1
|
|
|
|
#define _NET_WM_BOTTOMRIGHT 2
|
|
|
|
#define _NET_WM_BOTTOMLEFT 3
|
|
|
|
|
2002-05-16 04:03:36 +00:00
|
|
|
void
|
|
|
|
meta_screen_update_workspace_layout (MetaScreen *screen)
|
|
|
|
{
|
2015-06-23 22:09:07 +00:00
|
|
|
uint32_t *list;
|
2002-05-16 04:03:36 +00:00
|
|
|
int n_items;
|
2017-08-26 16:26:30 +00:00
|
|
|
MetaDisplay *display = screen->display;
|
2011-01-24 20:40:30 +00:00
|
|
|
|
|
|
|
if (screen->workspace_layout_overridden)
|
|
|
|
return;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-05-16 04:03:36 +00:00
|
|
|
list = NULL;
|
|
|
|
n_items = 0;
|
|
|
|
|
2017-08-26 18:51:28 +00:00
|
|
|
if (meta_prop_get_cardinal_list (display->x11_display,
|
2017-08-26 16:26:30 +00:00
|
|
|
display->x11_display->xroot,
|
|
|
|
display->x11_display->atom__NET_DESKTOP_LAYOUT,
|
2002-05-16 04:03:36 +00:00
|
|
|
&list, &n_items))
|
|
|
|
{
|
2002-10-01 19:57:26 +00:00
|
|
|
if (n_items == 3 || n_items == 4)
|
2002-05-16 04:03:36 +00:00
|
|
|
{
|
|
|
|
int cols, rows;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-05-16 04:03:36 +00:00
|
|
|
switch (list[0])
|
|
|
|
{
|
|
|
|
case _NET_WM_ORIENTATION_HORZ:
|
|
|
|
screen->vertical_workspaces = FALSE;
|
|
|
|
break;
|
|
|
|
case _NET_WM_ORIENTATION_VERT:
|
|
|
|
screen->vertical_workspaces = TRUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
meta_warning ("Someone set a weird orientation in _NET_DESKTOP_LAYOUT\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-10-01 19:57:26 +00:00
|
|
|
cols = list[1];
|
|
|
|
rows = list[2];
|
2002-05-16 04:03:36 +00:00
|
|
|
|
|
|
|
if (rows <= 0 && cols <= 0)
|
|
|
|
{
|
|
|
|
meta_warning ("Columns = %d rows = %d in _NET_DESKTOP_LAYOUT makes no sense\n", rows, cols);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (rows > 0)
|
|
|
|
screen->rows_of_workspaces = rows;
|
|
|
|
else
|
|
|
|
screen->rows_of_workspaces = -1;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-05-16 04:03:36 +00:00
|
|
|
if (cols > 0)
|
|
|
|
screen->columns_of_workspaces = cols;
|
|
|
|
else
|
|
|
|
screen->columns_of_workspaces = -1;
|
|
|
|
}
|
2002-10-01 19:57:26 +00:00
|
|
|
|
|
|
|
if (n_items == 4)
|
|
|
|
{
|
|
|
|
switch (list[3])
|
|
|
|
{
|
|
|
|
case _NET_WM_TOPLEFT:
|
|
|
|
screen->starting_corner = META_SCREEN_TOPLEFT;
|
|
|
|
break;
|
|
|
|
case _NET_WM_TOPRIGHT:
|
|
|
|
screen->starting_corner = META_SCREEN_TOPRIGHT;
|
|
|
|
break;
|
|
|
|
case _NET_WM_BOTTOMRIGHT:
|
|
|
|
screen->starting_corner = META_SCREEN_BOTTOMRIGHT;
|
|
|
|
break;
|
|
|
|
case _NET_WM_BOTTOMLEFT:
|
|
|
|
screen->starting_corner = META_SCREEN_BOTTOMLEFT;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
meta_warning ("Someone set a weird starting corner in _NET_DESKTOP_LAYOUT\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-11-17 00:06:58 +00:00
|
|
|
else
|
|
|
|
screen->starting_corner = META_SCREEN_TOPLEFT;
|
2002-05-16 04:03:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-10-01 19:57:26 +00:00
|
|
|
meta_warning ("Someone set _NET_DESKTOP_LAYOUT to %d integers instead of 4 "
|
|
|
|
"(3 is accepted for backwards compat)\n", n_items);
|
2002-05-16 04:03:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
meta_XFree (list);
|
|
|
|
}
|
|
|
|
|
2006-01-20 22:03:56 +00:00
|
|
|
meta_verbose ("Workspace layout rows = %d cols = %d orientation = %d starting corner = %u\n",
|
2002-05-16 04:03:36 +00:00
|
|
|
screen->rows_of_workspaces,
|
|
|
|
screen->columns_of_workspaces,
|
2002-10-01 19:57:26 +00:00
|
|
|
screen->vertical_workspaces,
|
|
|
|
screen->starting_corner);
|
2002-05-16 04:03:36 +00:00
|
|
|
}
|
2002-06-09 03:44:16 +00:00
|
|
|
|
2011-01-24 20:40:30 +00:00
|
|
|
/**
|
|
|
|
* meta_screen_override_workspace_layout:
|
|
|
|
* @screen: a #MetaScreen
|
|
|
|
* @starting_corner: the corner at which the first workspace is found
|
|
|
|
* @vertical_layout: if %TRUE the workspaces are laid out in columns rather than rows
|
|
|
|
* @n_rows: number of rows of workspaces, or -1 to determine the number of rows from
|
|
|
|
* @n_columns and the total number of workspaces
|
|
|
|
* @n_columns: number of columns of workspaces, or -1 to determine the number of columns from
|
|
|
|
* @n_rows and the total number of workspaces
|
|
|
|
*
|
|
|
|
* Explicitly set the layout of workspaces. Once this has been called, the contents of the
|
|
|
|
* _NET_DESKTOP_LAYOUT property on the root window are completely ignored.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
meta_screen_override_workspace_layout (MetaScreen *screen,
|
|
|
|
MetaScreenCorner starting_corner,
|
|
|
|
gboolean vertical_layout,
|
|
|
|
int n_rows,
|
|
|
|
int n_columns)
|
|
|
|
{
|
|
|
|
g_return_if_fail (META_IS_SCREEN (screen));
|
|
|
|
g_return_if_fail (n_rows > 0 || n_columns > 0);
|
|
|
|
g_return_if_fail (n_rows != 0 && n_columns != 0);
|
|
|
|
|
|
|
|
screen->workspace_layout_overridden = TRUE;
|
|
|
|
screen->vertical_workspaces = vertical_layout != FALSE;
|
|
|
|
screen->starting_corner = starting_corner;
|
|
|
|
screen->rows_of_workspaces = n_rows;
|
|
|
|
screen->columns_of_workspaces = n_columns;
|
|
|
|
|
|
|
|
/* In theory we should remove _NET_DESKTOP_LAYOUT from _NET_SUPPORTED at this
|
|
|
|
* point, but it's unlikely that anybody checks that, and it's unlikely that
|
|
|
|
* anybody who checks that handles changes, so we'd probably just create
|
|
|
|
* a race condition. And it's hard to implement with the code in set_supported_hint()
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
2002-11-03 19:06:39 +00:00
|
|
|
static void
|
2003-02-14 07:03:46 +00:00
|
|
|
set_workspace_names (MetaScreen *screen)
|
2002-11-03 19:06:39 +00:00
|
|
|
{
|
|
|
|
/* This updates names on root window when the pref changes,
|
|
|
|
* note we only get prefs change notify if things have
|
|
|
|
* really changed.
|
|
|
|
*/
|
2017-08-26 16:26:30 +00:00
|
|
|
MetaX11Display *x11_display = screen->display->x11_display;
|
2002-11-03 19:06:39 +00:00
|
|
|
GString *flattened;
|
|
|
|
int i;
|
|
|
|
int n_spaces;
|
|
|
|
|
|
|
|
/* flatten to nul-separated list */
|
|
|
|
n_spaces = meta_screen_get_n_workspaces (screen);
|
|
|
|
flattened = g_string_new ("");
|
|
|
|
i = 0;
|
|
|
|
while (i < n_spaces)
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
name = meta_prefs_get_workspace_name (i);
|
|
|
|
|
|
|
|
if (name)
|
2002-11-20 03:57:20 +00:00
|
|
|
g_string_append_len (flattened, name,
|
2002-11-03 19:06:39 +00:00
|
|
|
strlen (name) + 1);
|
|
|
|
else
|
|
|
|
g_string_append_len (flattened, "", 1);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-11-03 19:06:39 +00:00
|
|
|
++i;
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2017-08-26 16:27:50 +00:00
|
|
|
meta_error_trap_push (x11_display);
|
2017-08-26 16:26:30 +00:00
|
|
|
XChangeProperty (x11_display->xdisplay,
|
|
|
|
x11_display->xroot,
|
|
|
|
x11_display->atom__NET_DESKTOP_NAMES,
|
|
|
|
x11_display->atom_UTF8_STRING,
|
2002-11-03 19:06:39 +00:00
|
|
|
8, PropModeReplace,
|
2006-04-13 13:16:42 +00:00
|
|
|
(unsigned char *)flattened->str, flattened->len);
|
2017-08-26 16:27:50 +00:00
|
|
|
meta_error_trap_pop (x11_display);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-11-03 19:06:39 +00:00
|
|
|
g_string_free (flattened, TRUE);
|
|
|
|
}
|
|
|
|
|
2002-06-22 04:52:35 +00:00
|
|
|
void
|
|
|
|
meta_screen_update_workspace_names (MetaScreen *screen)
|
|
|
|
{
|
2017-08-26 16:26:30 +00:00
|
|
|
MetaX11Display *x11_display = screen->display->x11_display;
|
2002-06-22 04:52:35 +00:00
|
|
|
char **names;
|
|
|
|
int n_names;
|
|
|
|
int i;
|
2002-11-03 19:06:39 +00:00
|
|
|
|
|
|
|
/* this updates names in prefs when the root window property changes,
|
|
|
|
* iff the new property contents don't match what's already in prefs
|
|
|
|
*/
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-22 04:52:35 +00:00
|
|
|
names = NULL;
|
|
|
|
n_names = 0;
|
2017-08-26 18:51:28 +00:00
|
|
|
if (!meta_prop_get_utf8_list (x11_display,
|
2017-08-26 16:26:30 +00:00
|
|
|
x11_display->xroot,
|
|
|
|
x11_display->atom__NET_DESKTOP_NAMES,
|
2002-06-22 04:52:35 +00:00
|
|
|
&names, &n_names))
|
|
|
|
{
|
2016-07-21 13:03:56 +00:00
|
|
|
meta_verbose ("Failed to get workspace names from root window\n");
|
2002-06-22 04:52:35 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
i = 0;
|
2002-11-03 19:06:39 +00:00
|
|
|
while (i < n_names)
|
2002-06-22 04:52:35 +00:00
|
|
|
{
|
2002-11-20 03:57:20 +00:00
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
"Setting workspace %d name to \"%s\" due to _NET_DESKTOP_NAMES change\n",
|
|
|
|
i, names[i] ? names[i] : "null");
|
2002-11-03 19:06:39 +00:00
|
|
|
meta_prefs_change_workspace_name (i, names[i]);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-11-03 19:06:39 +00:00
|
|
|
++i;
|
2002-06-22 04:52:35 +00:00
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-22 04:52:35 +00:00
|
|
|
g_strfreev (names);
|
|
|
|
}
|
|
|
|
|
2002-10-21 21:44:35 +00:00
|
|
|
static void
|
2002-06-25 01:12:37 +00:00
|
|
|
set_work_area_hint (MetaScreen *screen)
|
|
|
|
{
|
2017-08-26 16:26:30 +00:00
|
|
|
MetaX11Display *x11_display = screen->display->x11_display;
|
2002-06-25 01:12:37 +00:00
|
|
|
int num_workspaces;
|
2014-08-15 23:49:49 +00:00
|
|
|
GList *l;
|
2002-06-25 01:12:37 +00:00
|
|
|
unsigned long *data, *tmp;
|
|
|
|
MetaRectangle area;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-25 01:12:37 +00:00
|
|
|
num_workspaces = meta_screen_get_n_workspaces (screen);
|
|
|
|
data = g_new (unsigned long, num_workspaces * 4);
|
|
|
|
tmp = data;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2014-08-15 23:49:49 +00:00
|
|
|
for (l = screen->workspaces; l != NULL; l = l->next)
|
2002-06-25 01:12:37 +00:00
|
|
|
{
|
2014-08-15 23:49:49 +00:00
|
|
|
MetaWorkspace *workspace = l->data;
|
2002-06-25 01:12:37 +00:00
|
|
|
|
2014-08-15 23:43:08 +00:00
|
|
|
meta_workspace_get_work_area_all_monitors (workspace, &area);
|
|
|
|
tmp[0] = area.x;
|
|
|
|
tmp[1] = area.y;
|
|
|
|
tmp[2] = area.width;
|
|
|
|
tmp[3] = area.height;
|
2002-06-25 01:12:37 +00:00
|
|
|
|
2014-08-15 23:43:08 +00:00
|
|
|
tmp += 4;
|
2002-06-25 01:12:37 +00:00
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2017-08-26 16:27:50 +00:00
|
|
|
meta_error_trap_push (x11_display);
|
2017-08-26 16:26:30 +00:00
|
|
|
XChangeProperty (x11_display->xdisplay,
|
|
|
|
x11_display->xroot,
|
|
|
|
x11_display->atom__NET_WORKAREA,
|
2002-06-25 01:12:37 +00:00
|
|
|
XA_CARDINAL, 32, PropModeReplace,
|
|
|
|
(guchar*) data, num_workspaces*4);
|
|
|
|
g_free (data);
|
2017-08-26 16:27:50 +00:00
|
|
|
meta_error_trap_pop (x11_display);
|
2009-09-17 08:49:23 +00:00
|
|
|
|
|
|
|
g_signal_emit (screen, screen_signals[WORKAREAS_CHANGED], 0);
|
2002-06-25 01:12:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2009-09-25 19:47:22 +00:00
|
|
|
set_work_area_later_func (MetaScreen *screen)
|
2002-06-25 01:12:37 +00:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
2009-09-25 19:47:22 +00:00
|
|
|
"Running work area hint computation function\n");
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2009-09-25 19:47:22 +00:00
|
|
|
screen->work_area_later = 0;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-25 01:12:37 +00:00
|
|
|
set_work_area_hint (screen);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-25 01:12:37 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_queue_workarea_recalc (MetaScreen *screen)
|
|
|
|
{
|
2009-09-25 19:47:22 +00:00
|
|
|
/* Recompute work area later before redrawing */
|
|
|
|
if (screen->work_area_later == 0)
|
2002-06-25 01:12:37 +00:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
2009-09-25 19:47:22 +00:00
|
|
|
"Adding work area hint computation function\n");
|
|
|
|
screen->work_area_later =
|
|
|
|
meta_later_add (META_LATER_BEFORE_REDRAW,
|
|
|
|
(GSourceFunc) set_work_area_later_func,
|
|
|
|
screen,
|
|
|
|
NULL);
|
2002-06-25 01:12:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-05 18:36:01 +00:00
|
|
|
|
|
|
|
#ifdef WITH_VERBOSE_MODE
|
2015-09-23 23:13:59 +00:00
|
|
|
static const char *
|
2003-01-05 18:36:01 +00:00
|
|
|
meta_screen_corner_to_string (MetaScreenCorner corner)
|
|
|
|
{
|
|
|
|
switch (corner)
|
|
|
|
{
|
|
|
|
case META_SCREEN_TOPLEFT:
|
|
|
|
return "TopLeft";
|
|
|
|
case META_SCREEN_TOPRIGHT:
|
|
|
|
return "TopRight";
|
|
|
|
case META_SCREEN_BOTTOMLEFT:
|
|
|
|
return "BottomLeft";
|
|
|
|
case META_SCREEN_BOTTOMRIGHT:
|
|
|
|
return "BottomRight";
|
|
|
|
}
|
|
|
|
|
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
|
|
|
|
2002-06-22 05:11:04 +00:00
|
|
|
void
|
2003-01-05 18:36:01 +00:00
|
|
|
meta_screen_calc_workspace_layout (MetaScreen *screen,
|
|
|
|
int num_workspaces,
|
|
|
|
int current_space,
|
|
|
|
MetaWorkspaceLayout *layout)
|
2002-06-22 05:11:04 +00:00
|
|
|
{
|
2003-01-05 18:36:01 +00:00
|
|
|
int rows, cols;
|
|
|
|
int grid_area;
|
|
|
|
int *grid;
|
|
|
|
int i, r, c;
|
|
|
|
int current_row, current_col;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-22 05:11:04 +00:00
|
|
|
rows = screen->rows_of_workspaces;
|
|
|
|
cols = screen->columns_of_workspaces;
|
|
|
|
if (rows <= 0 && cols <= 0)
|
|
|
|
cols = num_workspaces;
|
|
|
|
|
|
|
|
if (rows <= 0)
|
|
|
|
rows = num_workspaces / cols + ((num_workspaces % cols) > 0 ? 1 : 0);
|
|
|
|
if (cols <= 0)
|
|
|
|
cols = num_workspaces / rows + ((num_workspaces % rows) > 0 ? 1 : 0);
|
|
|
|
|
|
|
|
/* paranoia */
|
|
|
|
if (rows < 1)
|
|
|
|
rows = 1;
|
|
|
|
if (cols < 1)
|
|
|
|
cols = 1;
|
|
|
|
|
2003-01-05 18:36:01 +00:00
|
|
|
g_assert (rows != 0 && cols != 0);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2003-01-05 18:36:01 +00:00
|
|
|
grid_area = rows * cols;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2003-01-05 18:36:01 +00:00
|
|
|
meta_verbose ("Getting layout rows = %d cols = %d current = %d "
|
|
|
|
"num_spaces = %d vertical = %s corner = %s\n",
|
|
|
|
rows, cols, current_space, num_workspaces,
|
|
|
|
screen->vertical_workspaces ? "(true)" : "(false)",
|
|
|
|
meta_screen_corner_to_string (screen->starting_corner));
|
2014-05-02 13:34:02 +00:00
|
|
|
|
|
|
|
/* ok, we want to setup the distances in the workspace array to go
|
|
|
|
* in each direction. Remember, there are many ways that a workspace
|
|
|
|
* array can be setup.
|
|
|
|
* see http://www.freedesktop.org/standards/wm-spec/1.2/html/x109.html
|
|
|
|
* and look at the _NET_DESKTOP_LAYOUT section for details.
|
2003-01-05 18:36:01 +00:00
|
|
|
* For instance:
|
|
|
|
*/
|
2014-05-02 13:34:02 +00:00
|
|
|
/* starting_corner = META_SCREEN_TOPLEFT
|
2003-01-05 18:36:01 +00:00
|
|
|
* vertical_workspaces = 0 vertical_workspaces=1
|
2014-05-02 13:34:02 +00:00
|
|
|
* 1234 1357
|
|
|
|
* 5678 2468
|
|
|
|
*
|
|
|
|
* starting_corner = META_SCREEN_TOPRIGHT
|
2003-01-05 18:36:01 +00:00
|
|
|
* vertical_workspaces = 0 vertical_workspaces=1
|
2014-05-02 13:34:02 +00:00
|
|
|
* 4321 7531
|
|
|
|
* 8765 8642
|
|
|
|
*
|
|
|
|
* starting_corner = META_SCREEN_BOTTOMLEFT
|
2003-01-05 18:36:01 +00:00
|
|
|
* vertical_workspaces = 0 vertical_workspaces=1
|
2014-05-02 13:34:02 +00:00
|
|
|
* 5678 2468
|
|
|
|
* 1234 1357
|
|
|
|
*
|
|
|
|
* starting_corner = META_SCREEN_BOTTOMRIGHT
|
2003-01-05 18:36:01 +00:00
|
|
|
* vertical_workspaces = 0 vertical_workspaces=1
|
2014-05-02 13:34:02 +00:00
|
|
|
* 8765 8642
|
|
|
|
* 4321 7531
|
2003-01-05 18:36:01 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
/* keep in mind that we could have a ragged layout, e.g. the "8"
|
|
|
|
* in the above grids could be missing
|
|
|
|
*/
|
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2003-01-05 18:36:01 +00:00
|
|
|
grid = g_new (int, grid_area);
|
|
|
|
|
|
|
|
current_row = -1;
|
|
|
|
current_col = -1;
|
|
|
|
i = 0;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
|
|
|
switch (screen->starting_corner)
|
2003-01-05 18:36:01 +00:00
|
|
|
{
|
|
|
|
case META_SCREEN_TOPLEFT:
|
2014-05-02 13:34:02 +00:00
|
|
|
if (screen->vertical_workspaces)
|
2003-01-05 18:36:01 +00:00
|
|
|
{
|
|
|
|
c = 0;
|
|
|
|
while (c < cols)
|
|
|
|
{
|
|
|
|
r = 0;
|
|
|
|
while (r < rows)
|
|
|
|
{
|
|
|
|
grid[r*cols+c] = i;
|
|
|
|
++i;
|
|
|
|
++r;
|
|
|
|
}
|
|
|
|
++c;
|
|
|
|
}
|
|
|
|
}
|
2003-01-06 02:59:19 +00:00
|
|
|
else
|
2003-01-05 18:36:01 +00:00
|
|
|
{
|
|
|
|
r = 0;
|
|
|
|
while (r < rows)
|
|
|
|
{
|
2003-01-06 02:59:19 +00:00
|
|
|
c = 0;
|
|
|
|
while (c < cols)
|
2003-01-05 18:36:01 +00:00
|
|
|
{
|
|
|
|
grid[r*cols+c] = i;
|
|
|
|
++i;
|
2003-01-06 02:59:19 +00:00
|
|
|
++c;
|
2003-01-05 18:36:01 +00:00
|
|
|
}
|
|
|
|
++r;
|
|
|
|
}
|
|
|
|
}
|
2003-01-06 02:59:19 +00:00
|
|
|
break;
|
|
|
|
case META_SCREEN_TOPRIGHT:
|
2014-05-02 13:34:02 +00:00
|
|
|
if (screen->vertical_workspaces)
|
2003-01-05 18:36:01 +00:00
|
|
|
{
|
|
|
|
c = cols - 1;
|
|
|
|
while (c >= 0)
|
|
|
|
{
|
|
|
|
r = 0;
|
|
|
|
while (r < rows)
|
|
|
|
{
|
|
|
|
grid[r*cols+c] = i;
|
|
|
|
++i;
|
|
|
|
++r;
|
|
|
|
}
|
|
|
|
--c;
|
|
|
|
}
|
|
|
|
}
|
2003-01-06 02:59:19 +00:00
|
|
|
else
|
2003-01-05 18:36:01 +00:00
|
|
|
{
|
2003-01-06 02:59:19 +00:00
|
|
|
r = 0;
|
|
|
|
while (r < rows)
|
2003-01-05 18:36:01 +00:00
|
|
|
{
|
2003-01-06 02:59:19 +00:00
|
|
|
c = cols - 1;
|
|
|
|
while (c >= 0)
|
2003-01-05 18:36:01 +00:00
|
|
|
{
|
|
|
|
grid[r*cols+c] = i;
|
|
|
|
++i;
|
2003-01-06 02:59:19 +00:00
|
|
|
--c;
|
2003-01-05 18:36:01 +00:00
|
|
|
}
|
2003-01-06 02:59:19 +00:00
|
|
|
++r;
|
2003-01-05 18:36:01 +00:00
|
|
|
}
|
|
|
|
}
|
2003-01-06 02:59:19 +00:00
|
|
|
break;
|
|
|
|
case META_SCREEN_BOTTOMLEFT:
|
2014-05-02 13:34:02 +00:00
|
|
|
if (screen->vertical_workspaces)
|
2003-01-05 18:36:01 +00:00
|
|
|
{
|
|
|
|
c = 0;
|
|
|
|
while (c < cols)
|
|
|
|
{
|
|
|
|
r = rows - 1;
|
|
|
|
while (r >= 0)
|
|
|
|
{
|
|
|
|
grid[r*cols+c] = i;
|
|
|
|
++i;
|
|
|
|
--r;
|
|
|
|
}
|
|
|
|
++c;
|
|
|
|
}
|
|
|
|
}
|
2003-01-06 02:59:19 +00:00
|
|
|
else
|
2003-01-05 18:36:01 +00:00
|
|
|
{
|
|
|
|
r = rows - 1;
|
|
|
|
while (r >= 0)
|
|
|
|
{
|
2003-01-06 02:59:19 +00:00
|
|
|
c = 0;
|
|
|
|
while (c < cols)
|
2003-01-05 18:36:01 +00:00
|
|
|
{
|
|
|
|
grid[r*cols+c] = i;
|
|
|
|
++i;
|
2003-01-06 02:59:19 +00:00
|
|
|
++c;
|
2003-01-05 18:36:01 +00:00
|
|
|
}
|
|
|
|
--r;
|
|
|
|
}
|
|
|
|
}
|
2003-01-06 02:59:19 +00:00
|
|
|
break;
|
|
|
|
case META_SCREEN_BOTTOMRIGHT:
|
2014-05-02 13:34:02 +00:00
|
|
|
if (screen->vertical_workspaces)
|
2003-01-05 18:36:01 +00:00
|
|
|
{
|
|
|
|
c = cols - 1;
|
|
|
|
while (c >= 0)
|
|
|
|
{
|
|
|
|
r = rows - 1;
|
|
|
|
while (r >= 0)
|
|
|
|
{
|
|
|
|
grid[r*cols+c] = i;
|
|
|
|
++i;
|
|
|
|
--r;
|
|
|
|
}
|
|
|
|
--c;
|
|
|
|
}
|
|
|
|
}
|
2003-01-06 02:59:19 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
r = rows - 1;
|
|
|
|
while (r >= 0)
|
|
|
|
{
|
|
|
|
c = cols - 1;
|
|
|
|
while (c >= 0)
|
|
|
|
{
|
|
|
|
grid[r*cols+c] = i;
|
|
|
|
++i;
|
|
|
|
--c;
|
|
|
|
}
|
|
|
|
--r;
|
|
|
|
}
|
|
|
|
}
|
2003-01-05 18:36:01 +00:00
|
|
|
break;
|
2014-05-02 13:34:02 +00:00
|
|
|
}
|
2003-01-05 18:36:01 +00:00
|
|
|
|
|
|
|
if (i != grid_area)
|
|
|
|
meta_bug ("did not fill in the whole workspace grid in %s (%d filled)\n",
|
2008-01-28 14:52:34 +00:00
|
|
|
G_STRFUNC, i);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2003-01-05 18:36:01 +00:00
|
|
|
current_row = 0;
|
|
|
|
current_col = 0;
|
|
|
|
r = 0;
|
|
|
|
while (r < rows)
|
|
|
|
{
|
|
|
|
c = 0;
|
|
|
|
while (c < cols)
|
|
|
|
{
|
|
|
|
if (grid[r*cols+c] == current_space)
|
|
|
|
{
|
|
|
|
current_row = r;
|
|
|
|
current_col = c;
|
|
|
|
}
|
|
|
|
else if (grid[r*cols+c] >= num_workspaces)
|
|
|
|
{
|
|
|
|
/* flag nonexistent spaces with -1 */
|
|
|
|
grid[r*cols+c] = -1;
|
|
|
|
}
|
|
|
|
++c;
|
|
|
|
}
|
|
|
|
++r;
|
|
|
|
}
|
|
|
|
|
|
|
|
layout->rows = rows;
|
|
|
|
layout->cols = cols;
|
|
|
|
layout->grid = grid;
|
|
|
|
layout->grid_area = grid_area;
|
|
|
|
layout->current_row = current_row;
|
|
|
|
layout->current_col = current_col;
|
|
|
|
|
|
|
|
#ifdef WITH_VERBOSE_MODE
|
|
|
|
if (meta_is_verbose ())
|
|
|
|
{
|
|
|
|
r = 0;
|
|
|
|
while (r < layout->rows)
|
|
|
|
{
|
2003-01-06 02:59:19 +00:00
|
|
|
meta_verbose (" ");
|
2003-01-05 18:36:01 +00:00
|
|
|
meta_push_no_msg_prefix ();
|
|
|
|
c = 0;
|
|
|
|
while (c < layout->cols)
|
|
|
|
{
|
|
|
|
if (r == layout->current_row &&
|
|
|
|
c == layout->current_col)
|
|
|
|
meta_verbose ("*%2d ", layout->grid[r*layout->cols+c]);
|
|
|
|
else
|
|
|
|
meta_verbose ("%3d ", layout->grid[r*layout->cols+c]);
|
|
|
|
++c;
|
|
|
|
}
|
|
|
|
meta_verbose ("\n");
|
|
|
|
meta_pop_no_msg_prefix ();
|
|
|
|
++r;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_free_workspace_layout (MetaWorkspaceLayout *layout)
|
|
|
|
{
|
|
|
|
g_free (layout->grid);
|
2002-06-22 05:11:04 +00:00
|
|
|
}
|
2002-09-29 02:50:24 +00:00
|
|
|
|
2017-08-26 16:37:29 +00:00
|
|
|
void
|
|
|
|
meta_screen_on_monitors_changed (MetaScreen *screen)
|
2011-02-25 15:37:05 +00:00
|
|
|
{
|
2016-11-25 06:31:38 +00:00
|
|
|
reload_logical_monitors (screen);
|
2011-05-20 08:56:12 +00:00
|
|
|
|
2013-03-14 20:55:49 +00:00
|
|
|
meta_screen_queue_check_fullscreen (screen);
|
2017-10-13 00:14:40 +00:00
|
|
|
}
|
2017-02-24 10:10:52 +00:00
|
|
|
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 04:28:29 +00:00
|
|
|
void
|
|
|
|
meta_screen_update_showing_desktop_hint (MetaScreen *screen)
|
2002-10-16 20:12:24 +00:00
|
|
|
{
|
2017-08-26 16:26:30 +00:00
|
|
|
MetaX11Display *x11_display = screen->display->x11_display;
|
2002-10-16 20:12:24 +00:00
|
|
|
unsigned long data[1];
|
|
|
|
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 04:28:29 +00:00
|
|
|
data[0] = screen->active_workspace->showing_desktop ? 1 : 0;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2017-08-26 16:27:50 +00:00
|
|
|
meta_error_trap_push (x11_display);
|
2017-08-26 16:26:30 +00:00
|
|
|
XChangeProperty (x11_display->xdisplay,
|
|
|
|
x11_display->xroot,
|
|
|
|
x11_display->atom__NET_SHOWING_DESKTOP,
|
2002-10-16 20:12:24 +00:00
|
|
|
XA_CARDINAL,
|
|
|
|
32, PropModeReplace, (guchar*) data, 1);
|
2017-08-26 16:27:50 +00:00
|
|
|
meta_error_trap_pop (x11_display);
|
2002-10-16 20:12:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
queue_windows_showing (MetaScreen *screen)
|
|
|
|
{
|
2014-08-15 23:49:49 +00:00
|
|
|
GSList *windows, *l;
|
2002-10-16 20:12:24 +00:00
|
|
|
|
2004-10-22 20:28:36 +00:00
|
|
|
/* Must operate on all windows on display instead of just on the
|
|
|
|
* active_workspace's window list, because the active_workspace's
|
|
|
|
* window list may not contain the on_all_workspace windows.
|
|
|
|
*/
|
2009-06-15 19:32:23 +00:00
|
|
|
windows = meta_display_list_windows (screen->display, META_LIST_DEFAULT);
|
2002-10-16 20:12:24 +00:00
|
|
|
|
2014-08-15 23:49:49 +00:00
|
|
|
for (l = windows; l != NULL; l = l->next)
|
2002-10-16 20:12:24 +00:00
|
|
|
{
|
2014-08-15 23:49:49 +00:00
|
|
|
MetaWindow *w = l->data;
|
2014-08-15 23:43:08 +00:00
|
|
|
meta_window_queue (w, META_QUEUE_CALC_SHOWING);
|
2002-10-16 20:12:24 +00:00
|
|
|
}
|
2004-10-22 20:28:36 +00:00
|
|
|
|
|
|
|
g_slist_free (windows);
|
2002-10-16 20:12:24 +00:00
|
|
|
}
|
|
|
|
|
2003-05-16 21:59:08 +00:00
|
|
|
void
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 04:28:29 +00:00
|
|
|
meta_screen_minimize_all_on_active_workspace_except (MetaScreen *screen,
|
|
|
|
MetaWindow *keep)
|
2003-05-16 21:59:08 +00:00
|
|
|
{
|
2014-08-15 23:49:49 +00:00
|
|
|
GList *l;
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 04:28:29 +00:00
|
|
|
|
2014-08-15 23:49:49 +00:00
|
|
|
for (l = screen->active_workspace->windows; l != NULL; l = l->next)
|
2003-05-16 21:59:08 +00:00
|
|
|
{
|
2014-08-15 23:49:49 +00:00
|
|
|
MetaWindow *w = l->data;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2014-08-15 23:43:08 +00:00
|
|
|
if (w->has_minimize_func && w != keep)
|
2003-05-16 21:59:08 +00:00
|
|
|
meta_window_minimize (w);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-16 20:12:24 +00:00
|
|
|
void
|
2014-05-02 13:34:02 +00:00
|
|
|
meta_screen_show_desktop (MetaScreen *screen,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 16:32:33 +00:00
|
|
|
guint32 timestamp)
|
2002-10-16 20:12:24 +00:00
|
|
|
{
|
2014-08-15 23:49:49 +00:00
|
|
|
GList *l;
|
2004-12-20 02:46:42 +00:00
|
|
|
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 04:28:29 +00:00
|
|
|
if (screen->active_workspace->showing_desktop)
|
2002-10-16 20:12:24 +00:00
|
|
|
return;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 04:28:29 +00:00
|
|
|
screen->active_workspace->showing_desktop = TRUE;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-16 20:12:24 +00:00
|
|
|
queue_windows_showing (screen);
|
2004-12-20 02:46:42 +00:00
|
|
|
|
|
|
|
/* Focus the most recently used META_WINDOW_DESKTOP window, if there is one;
|
|
|
|
* see bug 159257.
|
|
|
|
*/
|
2014-08-15 23:49:49 +00:00
|
|
|
for (l = screen->active_workspace->mru_list; l != NULL; l = l->next)
|
2004-12-20 02:46:42 +00:00
|
|
|
{
|
2014-08-15 23:49:49 +00:00
|
|
|
MetaWindow *w = l->data;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2014-08-15 23:43:08 +00:00
|
|
|
if (w->type == META_WINDOW_DESKTOP)
|
2004-12-20 02:46:42 +00:00
|
|
|
{
|
|
|
|
meta_window_focus (w, timestamp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 04:28:29 +00:00
|
|
|
meta_screen_update_showing_desktop_hint (screen);
|
2002-10-16 20:12:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_unshow_desktop (MetaScreen *screen)
|
|
|
|
{
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 04:28:29 +00:00
|
|
|
if (!screen->active_workspace->showing_desktop)
|
2002-10-16 20:12:24 +00:00
|
|
|
return;
|
|
|
|
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 04:28:29 +00:00
|
|
|
screen->active_workspace->showing_desktop = FALSE;
|
|
|
|
|
2002-10-16 20:12:24 +00:00
|
|
|
queue_windows_showing (screen);
|
|
|
|
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 04:28:29 +00:00
|
|
|
meta_screen_update_showing_desktop_hint (screen);
|
2002-10-16 20:12:24 +00:00
|
|
|
}
|
2002-10-25 23:35:50 +00:00
|
|
|
|
2009-08-02 04:42:34 +00:00
|
|
|
/**
|
2011-08-30 19:12:09 +00:00
|
|
|
* meta_screen_get_startup_sequences: (skip)
|
2009-08-02 04:42:34 +00:00
|
|
|
* @screen:
|
|
|
|
*
|
2011-08-30 19:12:09 +00:00
|
|
|
* Return value: (transfer none): Currently active #SnStartupSequence items
|
2009-08-02 04:42:34 +00:00
|
|
|
*/
|
|
|
|
GSList *
|
|
|
|
meta_screen_get_startup_sequences (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
return screen->startup_sequences;
|
2002-10-25 23:35:50 +00:00
|
|
|
}
|
2002-12-01 03:58:04 +00:00
|
|
|
|
2007-06-18 02:37:14 +00:00
|
|
|
/* Sets the initial_timestamp and initial_workspace properties
|
|
|
|
* of a window according to information given us by the
|
|
|
|
* startup-notification library.
|
|
|
|
*
|
|
|
|
* Returns TRUE if startup properties have been applied, and
|
|
|
|
* FALSE if they have not (for example, if they had already
|
|
|
|
* been applied.)
|
|
|
|
*/
|
|
|
|
gboolean
|
2002-12-01 03:58:04 +00:00
|
|
|
meta_screen_apply_startup_properties (MetaScreen *screen,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_STARTUP_NOTIFICATION
|
|
|
|
const char *startup_id;
|
2014-08-15 23:49:49 +00:00
|
|
|
GSList *l;
|
2002-12-01 03:58:04 +00:00
|
|
|
SnStartupSequence *sequence;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2007-06-18 02:37:14 +00:00
|
|
|
/* Does the window have a startup ID stored? */
|
2002-12-01 03:58:04 +00:00
|
|
|
startup_id = meta_window_get_startup_id (window);
|
|
|
|
|
2003-01-23 01:53:18 +00:00
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Applying startup props to %s id \"%s\"\n",
|
|
|
|
window->desc,
|
|
|
|
startup_id ? startup_id : "(none)");
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-12-01 03:58:04 +00:00
|
|
|
sequence = NULL;
|
2003-01-23 01:53:18 +00:00
|
|
|
if (startup_id == NULL)
|
2002-12-01 03:58:04 +00:00
|
|
|
{
|
2007-06-18 02:37:14 +00:00
|
|
|
/* No startup ID stored for the window. Let's ask the
|
|
|
|
* startup-notification library whether there's anything
|
|
|
|
* stored for the resource name or resource class hints.
|
|
|
|
*/
|
2014-08-15 23:49:49 +00:00
|
|
|
for (l = screen->startup_sequences; l != NULL; l = l->next)
|
2003-01-23 01:53:18 +00:00
|
|
|
{
|
|
|
|
const char *wmclass;
|
2014-08-15 23:49:49 +00:00
|
|
|
SnStartupSequence *seq = l->data;
|
2002-12-01 03:58:04 +00:00
|
|
|
|
2014-08-15 23:49:49 +00:00
|
|
|
wmclass = sn_startup_sequence_get_wmclass (seq);
|
2002-12-01 03:58:04 +00:00
|
|
|
|
2003-01-23 01:53:18 +00:00
|
|
|
if (wmclass != NULL &&
|
|
|
|
((window->res_class &&
|
|
|
|
strcmp (wmclass, window->res_class) == 0) ||
|
|
|
|
(window->res_name &&
|
|
|
|
strcmp (wmclass, window->res_name) == 0)))
|
|
|
|
{
|
2014-08-15 23:49:49 +00:00
|
|
|
sequence = seq;
|
2003-01-23 01:53:18 +00:00
|
|
|
|
|
|
|
g_assert (window->startup_id == NULL);
|
|
|
|
window->startup_id = g_strdup (sn_startup_sequence_get_id (sequence));
|
|
|
|
startup_id = window->startup_id;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Ending legacy sequence %s due to window %s\n",
|
|
|
|
sn_startup_sequence_get_id (sequence),
|
|
|
|
window->desc);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2003-01-23 01:53:18 +00:00
|
|
|
sn_startup_sequence_complete (sequence);
|
|
|
|
break;
|
|
|
|
}
|
2002-12-01 03:58:04 +00:00
|
|
|
}
|
2003-01-23 01:53:18 +00:00
|
|
|
}
|
2002-12-01 03:58:04 +00:00
|
|
|
|
2007-06-18 02:37:14 +00:00
|
|
|
/* Still no startup ID? Bail. */
|
2003-01-23 01:53:18 +00:00
|
|
|
if (startup_id == NULL)
|
2007-06-18 02:37:14 +00:00
|
|
|
return FALSE;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2007-06-18 02:37:14 +00:00
|
|
|
/* We might get this far and not know the sequence ID (if the window
|
|
|
|
* already had a startup ID stored), so let's look for one if we don't
|
|
|
|
* already know it.
|
|
|
|
*/
|
2003-01-23 01:53:18 +00:00
|
|
|
if (sequence == NULL)
|
|
|
|
{
|
2014-08-15 23:49:49 +00:00
|
|
|
for (l = screen->startup_sequences; l != NULL; l = l->next)
|
2003-01-23 01:53:18 +00:00
|
|
|
{
|
2014-08-15 23:49:49 +00:00
|
|
|
SnStartupSequence *seq = l->data;
|
2003-01-23 01:53:18 +00:00
|
|
|
const char *id;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2014-08-15 23:49:49 +00:00
|
|
|
id = sn_startup_sequence_get_id (seq);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2003-01-23 01:53:18 +00:00
|
|
|
if (strcmp (id, startup_id) == 0)
|
|
|
|
{
|
2014-08-15 23:49:49 +00:00
|
|
|
sequence = seq;
|
2003-01-23 01:53:18 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2002-12-01 03:58:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (sequence != NULL)
|
|
|
|
{
|
2007-06-18 02:37:14 +00:00
|
|
|
gboolean changed_something = FALSE;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-12-01 03:58:04 +00:00
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Found startup sequence for window %s ID \"%s\"\n",
|
|
|
|
window->desc, startup_id);
|
|
|
|
|
|
|
|
if (!window->initial_workspace_set)
|
|
|
|
{
|
2007-06-18 02:37:14 +00:00
|
|
|
int space = sn_startup_sequence_get_workspace (sequence);
|
2002-12-01 03:58:04 +00:00
|
|
|
if (space >= 0)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Setting initial window workspace to %d based on startup info\n",
|
|
|
|
space);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-12-01 03:58:04 +00:00
|
|
|
window->initial_workspace_set = TRUE;
|
|
|
|
window->initial_workspace = space;
|
2007-06-18 02:37:14 +00:00
|
|
|
changed_something = TRUE;
|
2002-12-01 03:58:04 +00: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 15:47:05 +00:00
|
|
|
if (!window->initial_timestamp_set)
|
|
|
|
{
|
2007-06-18 02:37:14 +00:00
|
|
|
guint32 timestamp = sn_startup_sequence_get_timestamp (sequence);
|
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 15:47:05 +00:00
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 16:32:33 +00:00
|
|
|
"Setting initial window timestamp to %u based on startup info\n",
|
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 15:47:05 +00:00
|
|
|
timestamp);
|
2014-05-02 13:34:02 +00: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 15:47:05 +00:00
|
|
|
window->initial_timestamp_set = TRUE;
|
|
|
|
window->initial_timestamp = timestamp;
|
2007-06-18 02:37:14 +00:00
|
|
|
changed_something = TRUE;
|
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 15:47:05 +00:00
|
|
|
}
|
|
|
|
|
2007-06-18 02:37:14 +00:00
|
|
|
return changed_something;
|
2002-12-01 03:58:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Did not find startup sequence for window %s ID \"%s\"\n",
|
|
|
|
window->desc, startup_id);
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-12-01 03:58:04 +00:00
|
|
|
#endif /* HAVE_STARTUP_NOTIFICATION */
|
2007-06-18 02:37:14 +00:00
|
|
|
|
|
|
|
return FALSE;
|
2002-12-01 03:58:04 +00:00
|
|
|
}
|
|
|
|
|
2008-12-02 23:13:11 +00:00
|
|
|
/**
|
|
|
|
* meta_screen_get_display:
|
|
|
|
* @screen: A #MetaScreen
|
2014-05-02 13:34:02 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Retrieve the display associated with screen.
|
|
|
|
*
|
2014-05-02 13:34:02 +00:00
|
|
|
* Returns: (transfer none): Display
|
2008-12-02 23:13:11 +00:00
|
|
|
*/
|
2008-05-19 00:00:09 +00:00
|
|
|
MetaDisplay *
|
|
|
|
meta_screen_get_display (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
return screen->display;
|
|
|
|
}
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_screen_get_workspaces: (skip)
|
|
|
|
* @screen: a #MetaScreen
|
|
|
|
*
|
|
|
|
* Returns: (transfer none) (element-type Meta.Workspace): The workspaces for @screen
|
|
|
|
*/
|
2008-09-18 15:09:11 +00:00
|
|
|
GList *
|
|
|
|
meta_screen_get_workspaces (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
return screen->workspaces;
|
|
|
|
}
|
|
|
|
|
2008-11-03 12:32:25 +00:00
|
|
|
int
|
|
|
|
meta_screen_get_active_workspace_index (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
MetaWorkspace *active = screen->active_workspace;
|
|
|
|
|
|
|
|
if (!active)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return meta_workspace_index (active);
|
|
|
|
}
|
2008-11-20 12:41:28 +00:00
|
|
|
|
2009-09-04 00:57:01 +00:00
|
|
|
/**
|
|
|
|
* meta_screen_get_active_workspace:
|
2013-02-15 18:42:08 +00:00
|
|
|
* @screen: A #MetaScreen
|
2009-09-04 00:57:01 +00:00
|
|
|
*
|
|
|
|
* Returns: (transfer none): The current workspace
|
|
|
|
*/
|
2008-11-20 12:41:28 +00:00
|
|
|
MetaWorkspace *
|
|
|
|
meta_screen_get_active_workspace (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
return screen->active_workspace;
|
|
|
|
}
|
2009-03-12 21:07:27 +00:00
|
|
|
|
2012-12-04 19:30:55 +00:00
|
|
|
void
|
|
|
|
meta_screen_focus_default_window (MetaScreen *screen,
|
|
|
|
guint32 timestamp)
|
|
|
|
{
|
|
|
|
meta_workspace_focus_default_window (screen->active_workspace,
|
|
|
|
NULL,
|
|
|
|
timestamp);
|
|
|
|
}
|
|
|
|
|
2009-07-02 15:19:02 +00:00
|
|
|
void
|
|
|
|
meta_screen_workspace_switched (MetaScreen *screen,
|
|
|
|
int from,
|
|
|
|
int to,
|
|
|
|
MetaMotionDirection direction)
|
|
|
|
{
|
|
|
|
g_signal_emit (screen, screen_signals[WORKSPACE_SWITCHED], 0,
|
|
|
|
from, to, direction);
|
|
|
|
}
|
|
|
|
|
2011-01-25 21:27:31 +00:00
|
|
|
void
|
|
|
|
meta_screen_set_active_workspace_hint (MetaScreen *screen)
|
|
|
|
{
|
2017-08-26 16:26:30 +00:00
|
|
|
MetaX11Display *x11_display = screen->display->x11_display;
|
|
|
|
|
2011-01-25 21:27:31 +00:00
|
|
|
unsigned long data[1];
|
|
|
|
|
|
|
|
/* this is because we destroy the spaces in order,
|
|
|
|
* so we always end up setting a current desktop of
|
|
|
|
* 0 when closing a screen, so lose the current desktop
|
|
|
|
* on restart. By doing this we keep the current
|
|
|
|
* desktop on restart.
|
|
|
|
*/
|
|
|
|
if (screen->closing > 0)
|
|
|
|
return;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2011-01-25 21:27:31 +00:00
|
|
|
data[0] = meta_workspace_index (screen->active_workspace);
|
|
|
|
|
|
|
|
meta_verbose ("Setting _NET_CURRENT_DESKTOP to %lu\n", data[0]);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2017-08-26 16:27:50 +00:00
|
|
|
meta_error_trap_push (x11_display);
|
2017-08-26 16:26:30 +00:00
|
|
|
XChangeProperty (x11_display->xdisplay,
|
|
|
|
x11_display->xroot,
|
|
|
|
x11_display->atom__NET_CURRENT_DESKTOP,
|
2011-01-25 21:27:31 +00:00
|
|
|
XA_CARDINAL,
|
|
|
|
32, PropModeReplace, (guchar*) data, 1);
|
2017-08-26 16:27:50 +00:00
|
|
|
meta_error_trap_pop (x11_display);
|
2011-01-25 21:27:31 +00:00
|
|
|
}
|
|
|
|
|
2013-03-14 20:55:49 +00:00
|
|
|
static gboolean
|
|
|
|
check_fullscreen_func (gpointer data)
|
|
|
|
{
|
|
|
|
MetaScreen *screen = data;
|
2016-11-28 12:11:24 +00:00
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
2016-12-02 08:00:03 +00:00
|
|
|
GList *logical_monitors, *l;
|
2014-10-02 22:55:45 +00:00
|
|
|
MetaWindow *window;
|
2013-03-14 20:55:49 +00:00
|
|
|
GSList *fullscreen_monitors = NULL;
|
2014-10-02 22:55:45 +00:00
|
|
|
GSList *obscured_monitors = NULL;
|
2013-03-14 20:55:49 +00:00
|
|
|
gboolean in_fullscreen_changed = FALSE;
|
|
|
|
|
|
|
|
screen->check_fullscreen_later = 0;
|
|
|
|
|
2016-11-28 12:11:24 +00:00
|
|
|
logical_monitors =
|
2016-12-02 08:00:03 +00:00
|
|
|
meta_monitor_manager_get_logical_monitors (monitor_manager);
|
2016-11-28 12:11:24 +00:00
|
|
|
|
2014-10-02 22:55:45 +00:00
|
|
|
/* We consider a monitor in fullscreen if it contains a fullscreen window;
|
|
|
|
* however we make an exception for maximized windows above the fullscreen
|
|
|
|
* one, as in that case window+chrome fully obscure the fullscreen window.
|
|
|
|
*/
|
2017-08-26 17:03:51 +00:00
|
|
|
for (window = meta_stack_get_top (screen->display->stack);
|
2014-10-02 22:55:45 +00:00
|
|
|
window;
|
2017-08-26 17:03:51 +00:00
|
|
|
window = meta_stack_get_below (screen->display->stack, window, FALSE))
|
2013-03-14 20:55:49 +00:00
|
|
|
{
|
|
|
|
gboolean covers_monitors = FALSE;
|
|
|
|
|
|
|
|
if (window->screen != screen || window->hidden)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (window->fullscreen)
|
2014-10-02 22:55:45 +00:00
|
|
|
{
|
|
|
|
covers_monitors = TRUE;
|
|
|
|
}
|
|
|
|
else if (window->override_redirect)
|
2013-03-14 20:55:49 +00:00
|
|
|
{
|
|
|
|
/* We want to handle the case where an application is creating an
|
|
|
|
* override-redirect window the size of the screen (monitor) and treat
|
|
|
|
* it similarly to a fullscreen window, though it doesn't have fullscreen
|
|
|
|
* window management behavior. (Being O-R, it's not managed at all.)
|
|
|
|
*/
|
|
|
|
if (meta_window_is_monitor_sized (window))
|
|
|
|
covers_monitors = TRUE;
|
|
|
|
}
|
2014-10-02 22:55:45 +00:00
|
|
|
else if (window->maximized_horizontally &&
|
|
|
|
window->maximized_vertically)
|
2013-03-14 20:55:49 +00:00
|
|
|
{
|
2016-12-02 07:38:08 +00:00
|
|
|
MetaLogicalMonitor *logical_monitor;
|
|
|
|
|
|
|
|
logical_monitor = meta_window_get_main_logical_monitor (window);
|
|
|
|
if (!g_slist_find (obscured_monitors, logical_monitor))
|
|
|
|
obscured_monitors = g_slist_prepend (obscured_monitors,
|
|
|
|
logical_monitor);
|
2013-03-14 20:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (covers_monitors)
|
|
|
|
{
|
2016-12-02 07:38:08 +00:00
|
|
|
MetaRectangle window_rect;
|
|
|
|
|
|
|
|
meta_window_get_frame_rect (window, &window_rect);
|
2013-03-14 20:55:49 +00:00
|
|
|
|
2016-12-02 08:00:03 +00:00
|
|
|
for (l = logical_monitors; l; l = l->next)
|
2013-03-14 20:55:49 +00:00
|
|
|
{
|
2016-12-02 08:00:03 +00:00
|
|
|
MetaLogicalMonitor *logical_monitor = l->data;
|
2016-12-02 07:38:08 +00:00
|
|
|
|
|
|
|
if (meta_rectangle_overlap (&window_rect,
|
|
|
|
&logical_monitor->rect) &&
|
|
|
|
!g_slist_find (fullscreen_monitors, logical_monitor) &&
|
|
|
|
!g_slist_find (obscured_monitors, logical_monitor))
|
|
|
|
fullscreen_monitors = g_slist_prepend (fullscreen_monitors,
|
|
|
|
logical_monitor);
|
2013-03-14 20:55:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-02 22:55:45 +00:00
|
|
|
g_slist_free (obscured_monitors);
|
2013-03-14 20:55:49 +00:00
|
|
|
|
2016-12-02 08:00:03 +00:00
|
|
|
for (l = logical_monitors; l; l = l->next)
|
2013-03-14 20:55:49 +00:00
|
|
|
{
|
2016-12-02 08:00:03 +00:00
|
|
|
MetaLogicalMonitor *logical_monitor = l->data;
|
2016-12-02 07:38:08 +00:00
|
|
|
gboolean in_fullscreen;
|
|
|
|
|
|
|
|
in_fullscreen = g_slist_find (fullscreen_monitors,
|
|
|
|
logical_monitor) != NULL;
|
2016-11-25 06:31:38 +00:00
|
|
|
if (in_fullscreen != logical_monitor->in_fullscreen)
|
2013-03-14 20:55:49 +00:00
|
|
|
{
|
2016-11-25 06:31:38 +00:00
|
|
|
logical_monitor->in_fullscreen = in_fullscreen;
|
2013-03-14 20:55:49 +00:00
|
|
|
in_fullscreen_changed = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (fullscreen_monitors);
|
|
|
|
|
|
|
|
if (in_fullscreen_changed)
|
2016-10-24 15:09:46 +00:00
|
|
|
{
|
|
|
|
/* DOCK window stacking depends on the monitor's fullscreen
|
|
|
|
status so we need to trigger a re-layering. */
|
2017-08-26 17:03:51 +00:00
|
|
|
MetaWindow *window = meta_stack_get_top (screen->display->stack);
|
2016-10-24 15:09:46 +00:00
|
|
|
if (window)
|
2017-08-26 17:03:51 +00:00
|
|
|
meta_stack_update_layer (screen->display->stack, window);
|
2016-10-24 15:09:46 +00:00
|
|
|
|
|
|
|
g_signal_emit (screen, screen_signals[IN_FULLSCREEN_CHANGED], 0, NULL);
|
|
|
|
}
|
2013-03-14 20:55:49 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_queue_check_fullscreen (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
if (!screen->check_fullscreen_later)
|
|
|
|
screen->check_fullscreen_later = meta_later_add (META_LATER_CHECK_FULLSCREEN,
|
|
|
|
check_fullscreen_func,
|
|
|
|
screen, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* meta_screen_get_monitor_in_fullscreen:
|
|
|
|
* @screen: a #MetaScreen
|
|
|
|
* @monitor: the monitor number
|
|
|
|
*
|
|
|
|
* Determines whether there is a fullscreen window obscuring the specified
|
|
|
|
* monitor. If there is a fullscreen window, the desktop environment will
|
|
|
|
* typically hide any controls that might obscure the fullscreen window.
|
|
|
|
*
|
|
|
|
* You can get notification when this changes by connecting to
|
|
|
|
* MetaScreen::in-fullscreen-changed.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if there is a fullscreen window covering the specified monitor.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
meta_screen_get_monitor_in_fullscreen (MetaScreen *screen,
|
|
|
|
int monitor)
|
|
|
|
{
|
2016-11-28 12:11:24 +00:00
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
2016-12-02 08:00:03 +00:00
|
|
|
MetaLogicalMonitor *logical_monitor;
|
2016-11-28 12:11:24 +00:00
|
|
|
#ifndef G_DISABLE_CHECKS
|
|
|
|
int n_logical_monitors =
|
|
|
|
meta_monitor_manager_get_num_logical_monitors (monitor_manager);
|
|
|
|
#endif
|
|
|
|
|
2013-03-14 20:55:49 +00:00
|
|
|
g_return_val_if_fail (META_IS_SCREEN (screen), FALSE);
|
2016-11-25 06:31:38 +00:00
|
|
|
g_return_val_if_fail (monitor >= 0 &&
|
2016-11-28 12:11:24 +00:00
|
|
|
monitor < n_logical_monitors, FALSE);
|
|
|
|
|
2016-12-02 08:00:03 +00:00
|
|
|
logical_monitor =
|
|
|
|
meta_monitor_manager_get_logical_monitor_from_number (monitor_manager,
|
|
|
|
monitor);
|
2013-03-14 20:55:49 +00:00
|
|
|
|
|
|
|
/* We use -1 as a flag to mean "not known yet" for notification purposes */
|
2016-12-02 08:00:03 +00:00
|
|
|
return logical_monitor->in_fullscreen == TRUE;
|
2013-03-14 20:55:49 +00:00
|
|
|
}
|