2008-01-13 01:10:12 +00:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
2006-10-01 22:30:10 +00:00
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
/*
|
2001-05-30 15:36:31 +00:00
|
|
|
* Copyright (C) 2001 Havoc Pennington
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-19 00:45:24 +00:00
|
|
|
* Copyright (C) 2002, 2003, 2004 Red Hat, Inc.
|
2004-02-23 01:48:29 +00:00
|
|
|
* Copyright (C) 2003, 2004 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
|
|
|
*/
|
|
|
|
|
2013-03-11 15:52:36 +00:00
|
|
|
/**
|
|
|
|
* SECTION:display
|
|
|
|
* @title: MetaDisplay
|
|
|
|
* @short_description: Mutter X display handler
|
2008-01-08 03:59:12 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* The display is represented as a #MetaDisplay struct.
|
2008-01-08 03:59:12 +00:00
|
|
|
*/
|
|
|
|
|
2010-06-07 17:09:46 +00:00
|
|
|
#define _XOPEN_SOURCE 600 /* for gethostname() */
|
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
#include <config.h>
|
2008-05-19 00:00:09 +00:00
|
|
|
#include "display-private.h"
|
2014-03-20 19:29:30 +00:00
|
|
|
#include "events.h"
|
2013-09-11 08:18:53 +00:00
|
|
|
#include "util-private.h"
|
2011-03-06 00:29:12 +00:00
|
|
|
#include <meta/main.h>
|
2008-05-19 00:00:09 +00:00
|
|
|
#include "screen-private.h"
|
|
|
|
#include "window-private.h"
|
2011-03-06 00:29:12 +00:00
|
|
|
#include "frame.h"
|
|
|
|
#include <meta/errors.h>
|
2009-01-29 14:16:01 +00:00
|
|
|
#include "keybindings-private.h"
|
2011-03-06 00:29:12 +00:00
|
|
|
#include <meta/prefs.h>
|
2008-09-18 15:09:11 +00:00
|
|
|
#include "workspace-private.h"
|
2003-01-28 15:07:43 +00:00
|
|
|
#include "bell.h"
|
2011-03-06 00:29:12 +00:00
|
|
|
#include <meta/compositor.h>
|
2012-08-29 02:38:54 +00:00
|
|
|
#include <meta/compositor-mutter.h>
|
2001-06-10 03:17:15 +00:00
|
|
|
#include <X11/Xatom.h>
|
2012-02-10 15:27:14 +00:00
|
|
|
#include "mutter-enum-types.h"
|
2014-03-31 00:38:56 +00:00
|
|
|
#include "meta-idle-monitor-dbus.h"
|
2013-11-19 00:34:04 +00:00
|
|
|
#include "meta-cursor-tracker-private.h"
|
2014-08-05 12:11:59 +00:00
|
|
|
#include <meta/meta-backend.h>
|
2014-04-23 19:30:30 +00:00
|
|
|
#include "backends/x11/meta-backend-x11.h"
|
2014-06-19 21:13:38 +00:00
|
|
|
#include <clutter/x11/clutter-x11.h>
|
2012-02-10 15:27:14 +00:00
|
|
|
|
2003-01-03 19:06:53 +00:00
|
|
|
#ifdef HAVE_RANDR
|
|
|
|
#include <X11/extensions/Xrandr.h>
|
|
|
|
#endif
|
2003-01-05 07:51:02 +00:00
|
|
|
#include <X11/extensions/shape.h>
|
2005-07-11 13:25:08 +00:00
|
|
|
#include <X11/Xcursor/Xcursor.h>
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
#include <X11/extensions/Xcomposite.h>
|
|
|
|
#include <X11/extensions/Xdamage.h>
|
|
|
|
#include <X11/extensions/Xfixes.h>
|
2013-03-04 14:57:01 +00:00
|
|
|
#include <stdlib.h>
|
2001-06-10 03:17:15 +00:00
|
|
|
#include <string.h>
|
2010-06-07 16:32:56 +00:00
|
|
|
#include <unistd.h>
|
2001-05-30 15:36:31 +00:00
|
|
|
|
2014-08-15 16:48:55 +00:00
|
|
|
#include "x11/events.h"
|
2014-03-19 01:56:45 +00:00
|
|
|
#include "x11/window-x11.h"
|
|
|
|
#include "x11/window-props.h"
|
|
|
|
#include "x11/group-props.h"
|
|
|
|
#include "x11/xprops.h"
|
|
|
|
|
2014-08-14 00:19:35 +00:00
|
|
|
#ifdef HAVE_WAYLAND
|
2014-03-19 02:01:31 +00:00
|
|
|
#include "wayland/meta-xwayland-private.h"
|
2014-08-14 00:19:35 +00:00
|
|
|
#endif
|
2013-08-12 13:31:18 +00:00
|
|
|
|
2014-02-15 16:33:12 +00:00
|
|
|
/*
|
|
|
|
* SECTION:pings
|
|
|
|
*
|
|
|
|
* Sometimes we want to see whether a window is responding,
|
|
|
|
* so we send it a "ping" message and see whether it sends us back a "pong"
|
|
|
|
* message within a reasonable time. Here we have a system which lets us
|
|
|
|
* nominate one function to be called if we get the pong in time and another
|
|
|
|
* function if we don't. The system is rather more complicated than it needs
|
|
|
|
* to be, since we only ever use it to destroy windows which are asked to
|
|
|
|
* close themselves and don't do so within a reasonable amount of time, and
|
|
|
|
* therefore we always use the same callbacks. It's possible that we might
|
|
|
|
* use it for other things in future, or on the other hand we might decide
|
|
|
|
* that we're never going to do so and simplify it a bit.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MetaPingData:
|
|
|
|
*
|
|
|
|
* Describes a ping on a window. When we send a ping to a window, we build
|
|
|
|
* one of these structs, and it eventually gets passed to the timeout function
|
|
|
|
* or to the function which handles the response from the window. If the window
|
|
|
|
* does or doesn't respond to the ping, we use this information to deal with
|
|
|
|
* these facts; we have a handler function for each.
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
2014-05-20 18:48:08 +00:00
|
|
|
MetaWindow *window;
|
|
|
|
guint32 serial;
|
|
|
|
guint ping_timeout_id;
|
2014-02-15 16:33:12 +00:00
|
|
|
} MetaPingData;
|
|
|
|
|
2008-12-02 22:58:07 +00:00
|
|
|
G_DEFINE_TYPE(MetaDisplay, meta_display, G_TYPE_OBJECT);
|
|
|
|
|
2008-12-02 23:13:11 +00:00
|
|
|
/* Signals */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
OVERLAY_KEY,
|
2012-08-28 13:28:11 +00:00
|
|
|
ACCELERATOR_ACTIVATED,
|
2013-04-10 11:34:26 +00:00
|
|
|
MODIFIERS_ACCELERATOR_ACTIVATED,
|
2009-07-30 21:33:11 +00:00
|
|
|
FOCUS_WINDOW,
|
2009-10-13 14:34:34 +00:00
|
|
|
WINDOW_CREATED,
|
2009-10-28 17:19:24 +00:00
|
|
|
WINDOW_DEMANDS_ATTENTION,
|
2009-11-17 10:24:18 +00:00
|
|
|
WINDOW_MARKED_URGENT,
|
2012-02-10 15:27:14 +00:00
|
|
|
GRAB_OP_BEGIN,
|
|
|
|
GRAB_OP_END,
|
2014-05-08 22:35:49 +00:00
|
|
|
SHOW_RESTART_MESSAGE,
|
|
|
|
RESTART,
|
2008-12-02 23:13:11 +00:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2009-07-30 21:33:11 +00:00
|
|
|
enum {
|
|
|
|
PROP_0,
|
|
|
|
|
|
|
|
PROP_FOCUS_WINDOW
|
|
|
|
};
|
|
|
|
|
2008-12-02 23:13:11 +00:00
|
|
|
static guint display_signals [LAST_SIGNAL] = { 0 };
|
|
|
|
|
2011-11-02 15:34:45 +00:00
|
|
|
/*
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-25 03:39:13 +00:00
|
|
|
* The display we're managing. This is a singleton object. (Historically,
|
|
|
|
* this was a list of displays, but there was never any way to add more
|
|
|
|
* than one element to it.) The goofy name is because we don't want it
|
|
|
|
* to shadow the parameter in its object methods.
|
|
|
|
*/
|
|
|
|
static MetaDisplay *the_display = NULL;
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-27 02:05:39 +00:00
|
|
|
|
2011-10-20 14:22:35 +00:00
|
|
|
|
2012-11-05 13:55:15 +00:00
|
|
|
static const char *gnome_wm_keybindings = "Mutter";
|
2011-10-20 14:22:35 +00:00
|
|
|
static const char *net_wm_name = "Mutter";
|
|
|
|
|
2014-04-24 14:48:47 +00:00
|
|
|
static void update_cursor_theme (void);
|
2002-10-07 23:14:40 +00:00
|
|
|
|
|
|
|
static void prefs_changed_callback (MetaPreference pref,
|
|
|
|
void *data);
|
2014-04-24 14:48:47 +00:00
|
|
|
|
2009-07-30 21:33:11 +00:00
|
|
|
static void
|
|
|
|
meta_display_get_property(GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
MetaDisplay *display = META_DISPLAY (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_FOCUS_WINDOW:
|
|
|
|
g_value_set_object (value, display->focus_window);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_display_set_property(GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-02 22:58:07 +00:00
|
|
|
static void
|
|
|
|
meta_display_class_init (MetaDisplayClass *klass)
|
|
|
|
{
|
2009-07-30 21:33:11 +00:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
object_class->get_property = meta_display_get_property;
|
|
|
|
object_class->set_property = meta_display_set_property;
|
|
|
|
|
2008-12-02 23:13:11 +00:00
|
|
|
display_signals[OVERLAY_KEY] =
|
|
|
|
g_signal_new ("overlay-key",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
2011-10-18 22:06:14 +00:00
|
|
|
NULL, NULL, NULL,
|
2009-07-30 21:33:11 +00:00
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
2012-08-28 13:28:11 +00:00
|
|
|
display_signals[ACCELERATOR_ACTIVATED] =
|
|
|
|
g_signal_new ("accelerator-activated",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
|
|
|
NULL, NULL, NULL,
|
2013-07-25 12:13:27 +00:00
|
|
|
G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
|
2012-08-28 13:28:11 +00:00
|
|
|
|
2013-04-10 11:34:26 +00:00
|
|
|
/**
|
|
|
|
* MetaDisplay::modifiers-accelerator-activated:
|
|
|
|
* @display: the #MetaDisplay instance
|
|
|
|
*
|
|
|
|
* The ::modifiers-accelerator-activated signal will be emitted when
|
|
|
|
* a special modifiers-only keybinding is activated.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE means that the keyboard device should remain
|
|
|
|
* frozen and %FALSE for the default behavior of unfreezing the
|
|
|
|
* keyboard.
|
|
|
|
*/
|
|
|
|
display_signals[MODIFIERS_ACCELERATOR_ACTIVATED] =
|
|
|
|
g_signal_new ("modifiers-accelerator-activated",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
|
|
|
g_signal_accumulator_first_wins, NULL, NULL,
|
|
|
|
G_TYPE_BOOLEAN, 0);
|
|
|
|
|
2009-10-13 14:34:34 +00:00
|
|
|
display_signals[WINDOW_CREATED] =
|
|
|
|
g_signal_new ("window-created",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
2011-10-18 22:06:14 +00:00
|
|
|
NULL, NULL, NULL,
|
2009-10-13 14:34:34 +00:00
|
|
|
G_TYPE_NONE, 1, META_TYPE_WINDOW);
|
|
|
|
|
2009-10-28 17:19:24 +00:00
|
|
|
display_signals[WINDOW_DEMANDS_ATTENTION] =
|
|
|
|
g_signal_new ("window-demands-attention",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
2011-10-18 22:06:14 +00:00
|
|
|
NULL, NULL, NULL,
|
2009-10-28 17:19:24 +00:00
|
|
|
G_TYPE_NONE, 1, META_TYPE_WINDOW);
|
2009-10-13 14:34:34 +00:00
|
|
|
|
2009-11-17 10:24:18 +00:00
|
|
|
display_signals[WINDOW_MARKED_URGENT] =
|
|
|
|
g_signal_new ("window-marked-urgent",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
2011-10-18 22:06:14 +00:00
|
|
|
NULL, NULL, NULL,
|
2009-11-17 10:24:18 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
META_TYPE_WINDOW);
|
|
|
|
|
2012-02-10 15:27:14 +00:00
|
|
|
display_signals[GRAB_OP_BEGIN] =
|
|
|
|
g_signal_new ("grab-op-begin",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
|
|
|
NULL, NULL, NULL,
|
|
|
|
G_TYPE_NONE, 3,
|
|
|
|
META_TYPE_SCREEN,
|
|
|
|
META_TYPE_WINDOW,
|
|
|
|
META_TYPE_GRAB_OP);
|
|
|
|
|
|
|
|
display_signals[GRAB_OP_END] =
|
|
|
|
g_signal_new ("grab-op-end",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
|
|
|
NULL, NULL, NULL,
|
|
|
|
G_TYPE_NONE, 3,
|
|
|
|
META_TYPE_SCREEN,
|
|
|
|
META_TYPE_WINDOW,
|
|
|
|
META_TYPE_GRAB_OP);
|
|
|
|
|
2014-05-08 22:35:49 +00:00
|
|
|
/**
|
|
|
|
* MetaDisplay::show-restart-message:
|
|
|
|
* @display: the #MetaDisplay instance
|
|
|
|
* @message: (allow-none): The message to display, or %NULL
|
|
|
|
* to clear a previous restart message.
|
|
|
|
*
|
|
|
|
* The ::show-restart-message signal will be emitted to indicate
|
|
|
|
* that the compositor should show a message during restart. This is
|
|
|
|
* emitted when meta_restart() is called, either by Mutter
|
|
|
|
* internally or by the embedding compositor. The message should be
|
|
|
|
* immediately added to the Clutter stage in its final form -
|
|
|
|
* ::restart will be emitted to exit the application and leave the
|
|
|
|
* stage contents frozen as soon as the the stage is painted again.
|
|
|
|
*
|
|
|
|
* On case of failure to restart, this signal will be emitted again
|
|
|
|
* with %NULL for @message.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE means the message was added to the stage; %FALSE
|
|
|
|
* indicates that the compositor did not show the message.
|
|
|
|
*/
|
|
|
|
display_signals[SHOW_RESTART_MESSAGE] =
|
|
|
|
g_signal_new ("show-restart-message",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
|
|
|
g_signal_accumulator_true_handled,
|
|
|
|
NULL, NULL,
|
|
|
|
G_TYPE_BOOLEAN, 1,
|
|
|
|
G_TYPE_STRING);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MetaDisplay::restart:
|
|
|
|
* @display: the #MetaDisplay instance
|
|
|
|
*
|
|
|
|
* The ::restart signal is emitted to indicate that compositor
|
|
|
|
* should reexec the process. This is
|
|
|
|
* emitted when meta_restart() is called, either by Mutter
|
|
|
|
* internally or by the embedding compositor. See also
|
|
|
|
* ::show-restart-message.
|
|
|
|
*
|
|
|
|
* Returns: %FALSE to indicate that the compositor could not
|
|
|
|
* be restarted. When the compositor is restarted, the signal
|
|
|
|
* should not return.
|
|
|
|
*/
|
|
|
|
display_signals[RESTART] =
|
|
|
|
g_signal_new ("restart",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
|
|
|
g_signal_accumulator_true_handled,
|
|
|
|
NULL, NULL,
|
|
|
|
G_TYPE_BOOLEAN, 0);
|
|
|
|
|
2009-07-30 21:33:11 +00:00
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_FOCUS_WINDOW,
|
|
|
|
g_param_spec_object ("focus-window",
|
|
|
|
"Focus window",
|
|
|
|
"Currently focused window",
|
|
|
|
META_TYPE_WINDOW,
|
|
|
|
G_PARAM_READABLE));
|
2008-12-02 22:58:07 +00:00
|
|
|
}
|
|
|
|
|
2014-02-15 16:33:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ping_data_free:
|
|
|
|
*
|
|
|
|
* Destructor for #MetaPingData structs. Will destroy the
|
|
|
|
* event source for the struct as well.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
ping_data_free (MetaPingData *ping_data)
|
|
|
|
{
|
|
|
|
/* Remove the timeout */
|
|
|
|
if (ping_data->ping_timeout_id != 0)
|
|
|
|
g_source_remove (ping_data->ping_timeout_id);
|
|
|
|
|
|
|
|
g_free (ping_data);
|
|
|
|
}
|
|
|
|
|
2014-07-08 16:16:11 +00:00
|
|
|
void
|
|
|
|
meta_display_remove_pending_pings_for_window (MetaDisplay *display,
|
|
|
|
MetaWindow *window)
|
2014-02-15 16:33:12 +00:00
|
|
|
{
|
|
|
|
GSList *tmp;
|
|
|
|
GSList *dead;
|
|
|
|
|
|
|
|
/* could obviously be more efficient, don't care */
|
|
|
|
|
|
|
|
/* build list to be removed */
|
|
|
|
dead = NULL;
|
|
|
|
for (tmp = display->pending_pings; tmp; tmp = tmp->next)
|
|
|
|
{
|
|
|
|
MetaPingData *ping_data = tmp->data;
|
|
|
|
|
2014-07-08 16:16:11 +00:00
|
|
|
if (ping_data->window == window)
|
2014-02-15 16:33:12 +00:00
|
|
|
dead = g_slist_prepend (dead, ping_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* remove what we found */
|
|
|
|
for (tmp = dead; tmp; tmp = tmp->next)
|
|
|
|
{
|
|
|
|
MetaPingData *ping_data = tmp->data;
|
|
|
|
|
|
|
|
display->pending_pings = g_slist_remove (display->pending_pings, ping_data);
|
|
|
|
ping_data_free (ping_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (dead);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-10-26 01:49:03 +00:00
|
|
|
#ifdef HAVE_STARTUP_NOTIFICATION
|
2002-10-25 23:35:50 +00:00
|
|
|
static void
|
|
|
|
sn_error_trap_push (SnDisplay *sn_display,
|
|
|
|
Display *xdisplay)
|
|
|
|
{
|
|
|
|
MetaDisplay *display;
|
|
|
|
display = meta_display_for_x_display (xdisplay);
|
|
|
|
if (display != NULL)
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
sn_error_trap_pop (SnDisplay *sn_display,
|
|
|
|
Display *xdisplay)
|
|
|
|
{
|
|
|
|
MetaDisplay *display;
|
|
|
|
display = meta_display_for_x_display (xdisplay);
|
|
|
|
if (display != NULL)
|
2010-10-25 18:44:30 +00:00
|
|
|
meta_error_trap_pop (display);
|
2002-10-25 23:35:50 +00:00
|
|
|
}
|
2002-10-26 01:49:03 +00:00
|
|
|
#endif
|
2002-10-25 23:35:50 +00:00
|
|
|
|
2006-02-16 20:26:05 +00:00
|
|
|
static void
|
2013-02-07 11:48:12 +00:00
|
|
|
enable_compositor (MetaDisplay *display)
|
2006-02-16 20:26:05 +00:00
|
|
|
{
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
if (!META_DISPLAY_HAS_COMPOSITE (display) ||
|
2014-04-22 16:46:28 +00:00
|
|
|
!META_DISPLAY_HAS_DAMAGE (display))
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
{
|
2013-09-11 08:37:36 +00:00
|
|
|
meta_warning ("Missing %s extension required for compositing",
|
2014-04-22 16:46:28 +00:00
|
|
|
!META_DISPLAY_HAS_COMPOSITE (display) ? "composite" : "damage");
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-08-13 23:32:39 +00:00
|
|
|
int version = (display->composite_major_version * 10) + display->composite_minor_version;
|
|
|
|
if (version < 3)
|
|
|
|
{
|
|
|
|
meta_warning ("Your version of COMPOSITE is too old.");
|
|
|
|
return;
|
|
|
|
}
|
2006-02-16 20:26:05 +00:00
|
|
|
|
|
|
|
if (!display->compositor)
|
2014-08-13 23:32:39 +00:00
|
|
|
display->compositor = meta_compositor_new (display);
|
2013-10-03 22:31:09 +00:00
|
|
|
|
2014-03-18 21:31:22 +00:00
|
|
|
meta_compositor_manage (display->compositor);
|
2006-02-16 20:26:05 +00:00
|
|
|
}
|
|
|
|
|
2008-12-02 22:58:07 +00:00
|
|
|
static void
|
|
|
|
meta_display_init (MetaDisplay *disp)
|
|
|
|
{
|
|
|
|
/* Some stuff could go in here that's currently in _open,
|
|
|
|
* but it doesn't really matter. */
|
|
|
|
}
|
|
|
|
|
2011-10-20 14:22:35 +00:00
|
|
|
/**
|
|
|
|
* meta_set_wm_name: (skip)
|
|
|
|
* @wm_name: value for _NET_WM_NAME
|
|
|
|
*
|
|
|
|
* Set the value to use for the _NET_WM_NAME property. To take effect,
|
|
|
|
* it is necessary to call this function before meta_init().
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
meta_set_wm_name (const char *wm_name)
|
|
|
|
{
|
|
|
|
g_return_if_fail (the_display == NULL);
|
|
|
|
|
|
|
|
net_wm_name = wm_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* meta_set_gnome_wm_keybindings: (skip)
|
|
|
|
* @wm_keybindings: value for _GNOME_WM_KEYBINDINGS
|
|
|
|
*
|
|
|
|
* Set the value to use for the _GNOME_WM_KEYBINDINGS property. To take
|
|
|
|
* effect, it is necessary to call this function before meta_init().
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
meta_set_gnome_wm_keybindings (const char *wm_keybindings)
|
|
|
|
{
|
|
|
|
g_return_if_fail (the_display == NULL);
|
|
|
|
|
|
|
|
gnome_wm_keybindings = wm_keybindings;
|
|
|
|
}
|
|
|
|
|
2014-07-22 00:07:19 +00:00
|
|
|
void
|
2014-07-22 00:07:19 +00:00
|
|
|
meta_display_cancel_touch (MetaDisplay *display)
|
|
|
|
{
|
2014-08-14 00:19:35 +00:00
|
|
|
#ifdef HAVE_WAYLAND
|
2014-07-22 00:07:19 +00:00
|
|
|
MetaWaylandCompositor *compositor;
|
|
|
|
|
|
|
|
if (!meta_is_wayland_compositor ())
|
|
|
|
return;
|
|
|
|
|
|
|
|
compositor = meta_wayland_compositor_get_default ();
|
|
|
|
meta_wayland_touch_cancel (&compositor->seat->touch);
|
2014-08-14 00:19:35 +00:00
|
|
|
#endif
|
2014-07-22 00:07:19 +00:00
|
|
|
}
|
|
|
|
|
2014-06-19 21:13:38 +00:00
|
|
|
static void
|
|
|
|
gesture_tracker_state_changed (MetaGestureTracker *tracker,
|
|
|
|
ClutterEventSequence *sequence,
|
|
|
|
MetaSequenceState state,
|
|
|
|
MetaDisplay *display)
|
|
|
|
{
|
2014-07-21 23:46:42 +00:00
|
|
|
if (meta_is_wayland_compositor ())
|
|
|
|
{
|
|
|
|
if (state == META_SEQUENCE_ACCEPTED)
|
|
|
|
meta_display_cancel_touch (display);
|
|
|
|
}
|
2014-06-19 21:13:38 +00:00
|
|
|
else
|
2014-07-21 23:46:42 +00:00
|
|
|
{
|
|
|
|
MetaBackendX11 *backend = META_BACKEND_X11 (meta_get_backend ());
|
|
|
|
int event_mode;
|
|
|
|
|
|
|
|
if (state == META_SEQUENCE_ACCEPTED)
|
|
|
|
event_mode = XIAcceptTouch;
|
|
|
|
else if (state == META_SEQUENCE_REJECTED)
|
|
|
|
event_mode = XIRejectTouch;
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
|
|
|
|
XIAllowTouchEvents (meta_backend_x11_get_xdisplay (backend),
|
|
|
|
META_VIRTUAL_CORE_POINTER_ID,
|
|
|
|
clutter_x11_event_sequence_get_touch_detail (sequence),
|
|
|
|
DefaultRootWindow (display->xdisplay), event_mode);
|
|
|
|
}
|
2014-06-19 21:13:38 +00:00
|
|
|
}
|
|
|
|
|
2008-01-13 01:01:21 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* meta_display_open:
|
|
|
|
*
|
2008-01-13 01:01:21 +00:00
|
|
|
* Opens a new display, sets it up, initialises all the X extensions
|
2008-01-08 03:59:12 +00:00
|
|
|
* we will need, and adds it to the list of displays.
|
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Returns: %TRUE if the display was opened successfully, and %FALSE
|
2008-01-08 03:59:12 +00:00
|
|
|
* otherwise-- that is, if the display doesn't exist or it already
|
|
|
|
* has a window manager.
|
|
|
|
*/
|
2001-05-30 15:36:31 +00:00
|
|
|
gboolean
|
2006-05-04 17:32:26 +00:00
|
|
|
meta_display_open (void)
|
2001-05-30 15:36:31 +00:00
|
|
|
{
|
2014-07-10 21:58:58 +00:00
|
|
|
MetaDisplay *display;
|
2001-05-30 15:36:31 +00:00
|
|
|
Display *xdisplay;
|
2012-09-10 18:19:21 +00:00
|
|
|
MetaScreen *screen;
|
2002-03-02 15:26:07 +00:00
|
|
|
int i;
|
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;
|
2008-05-02 18:49:01 +00:00
|
|
|
|
|
|
|
/* A list of all atom names, so that we can intern them in one go. */
|
2001-06-04 06:17:52 +00:00
|
|
|
char *atom_names[] = {
|
2008-05-02 18:49:01 +00:00
|
|
|
#define item(x) #x,
|
2011-03-06 00:29:12 +00:00
|
|
|
#include <meta/atomnames.h>
|
2008-05-02 18:49:01 +00:00
|
|
|
#undef item
|
2001-06-04 06:17:52 +00:00
|
|
|
};
|
2001-06-02 04:14:18 +00:00
|
|
|
Atom atoms[G_N_ELEMENTS(atom_names)];
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2006-05-04 17:32:26 +00:00
|
|
|
meta_verbose ("Opening display '%s'\n", XDisplayName (NULL));
|
2001-05-30 15:36:31 +00:00
|
|
|
|
2006-05-04 17:32:26 +00:00
|
|
|
xdisplay = meta_ui_get_display ();
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-05-30 15:36:31 +00:00
|
|
|
if (xdisplay == NULL)
|
|
|
|
{
|
|
|
|
meta_warning (_("Failed to open X Window System display '%s'\n"),
|
2006-05-04 17:32:26 +00:00
|
|
|
XDisplayName (NULL));
|
2001-05-30 15:36:31 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2014-08-14 00:19:35 +00:00
|
|
|
#ifdef HAVE_WAYLAND
|
2013-08-12 13:31:18 +00:00
|
|
|
if (meta_is_wayland_compositor ())
|
|
|
|
meta_xwayland_complete_init ();
|
2014-08-14 00:19:35 +00:00
|
|
|
#endif
|
2013-08-12 13:31:18 +00:00
|
|
|
|
2001-05-31 06:42:58 +00:00
|
|
|
if (meta_is_syncing ())
|
|
|
|
XSynchronize (xdisplay, True);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-25 03:39:13 +00:00
|
|
|
g_assert (the_display == NULL);
|
2014-07-10 21:58:58 +00:00
|
|
|
display = the_display = g_object_new (META_TYPE_DISPLAY, NULL);
|
2001-06-03 01:33:27 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->closing = 0;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-06-03 01:33:27 +00:00
|
|
|
/* here we use XDisplayName which is what the user
|
|
|
|
* probably put in, vs. DisplayString(display) which is
|
|
|
|
* canonicalized by XOpenDisplay()
|
|
|
|
*/
|
2014-07-10 21:58:58 +00:00
|
|
|
display->name = g_strdup (XDisplayName (NULL));
|
|
|
|
display->xdisplay = xdisplay;
|
|
|
|
display->display_opening = TRUE;
|
|
|
|
|
|
|
|
display->pending_pings = NULL;
|
|
|
|
display->autoraise_timeout_id = 0;
|
|
|
|
display->autoraise_window = NULL;
|
|
|
|
display->focus_window = NULL;
|
|
|
|
display->focus_serial = 0;
|
|
|
|
display->server_focus_window = None;
|
|
|
|
display->server_focus_serial = 0;
|
|
|
|
|
|
|
|
display->mouse_mode = TRUE; /* Only relevant for mouse or sloppy focus */
|
|
|
|
display->allow_terminal_deactivation = TRUE; /* Only relevant for when a
|
2006-01-15 17:03:57 +00:00
|
|
|
terminal has the focus */
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
meta_bell_init (display);
|
2003-01-28 15:07:43 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
meta_display_init_keys (display);
|
2001-06-09 05:14:43 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
meta_prefs_add_listener (prefs_changed_callback, display);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
2007-12-19 21:38:15 +00:00
|
|
|
meta_verbose ("Creating %d atoms\n", (int) G_N_ELEMENTS (atom_names));
|
2014-07-10 21:58:58 +00:00
|
|
|
XInternAtoms (display->xdisplay, atom_names, G_N_ELEMENTS (atom_names),
|
2001-06-09 05:14:43 +00:00
|
|
|
False, atoms);
|
2008-05-02 18:49:01 +00:00
|
|
|
{
|
2014-05-02 13:34:02 +00:00
|
|
|
int i = 0;
|
2014-07-10 21:58:58 +00:00
|
|
|
#define item(x) display->atom_##x = atoms[i++];
|
2011-03-06 00:29:12 +00:00
|
|
|
#include <meta/atomnames.h>
|
2008-05-02 18:49:01 +00:00
|
|
|
#undef item
|
|
|
|
}
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-25 03:39:13 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->prop_hooks = NULL;
|
|
|
|
meta_display_init_window_prop_hooks (display);
|
|
|
|
display->group_prop_hooks = NULL;
|
|
|
|
meta_display_init_group_prop_hooks (display);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-06-10 19:23:28 +00:00
|
|
|
/* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK,
|
|
|
|
* created in screen_new
|
|
|
|
*/
|
2014-07-10 21:58:58 +00:00
|
|
|
display->leader_window = None;
|
|
|
|
display->timestamp_pinging_window = None;
|
2002-06-07 03:18:46 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->monitor_cache_invalidated = TRUE;
|
2002-08-12 21:32:13 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->groups_by_leader = NULL;
|
2002-05-08 16:24:28 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->screen = NULL;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-25 23:35:50 +00:00
|
|
|
#ifdef HAVE_STARTUP_NOTIFICATION
|
2014-07-10 21:58:58 +00:00
|
|
|
display->sn_display = sn_display_new (display->xdisplay,
|
2002-10-25 23:35:50 +00:00
|
|
|
sn_error_trap_push,
|
|
|
|
sn_error_trap_pop);
|
|
|
|
#endif
|
2001-06-20 03:01:26 +00:00
|
|
|
|
|
|
|
/* Get events */
|
2014-07-10 21:58:58 +00:00
|
|
|
meta_display_init_events (display);
|
2014-08-15 16:48:55 +00:00
|
|
|
meta_display_init_events_x11 (display);
|
2013-11-14 17:58:52 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->xids = g_hash_table_new (meta_unsigned_long_hash,
|
2013-02-06 22:02:59 +00:00
|
|
|
meta_unsigned_long_equal);
|
2014-07-10 21:58:58 +00:00
|
|
|
display->wayland_windows = g_hash_table_new (NULL, NULL);
|
2012-07-30 18:57:53 +00:00
|
|
|
|
2002-03-02 15:26:07 +00:00
|
|
|
i = 0;
|
2011-09-12 13:50:30 +00:00
|
|
|
while (i < N_IGNORED_CROSSING_SERIALS)
|
2002-03-02 15:26:07 +00:00
|
|
|
{
|
2014-07-10 21:58:58 +00:00
|
|
|
display->ignored_crossing_serials[i] = 0;
|
2002-03-02 15:26:07 +00:00
|
|
|
++i;
|
|
|
|
}
|
2014-07-10 21:58:58 +00:00
|
|
|
display->ungrab_should_not_cause_focus_window = None;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->current_time = CurrentTime;
|
|
|
|
display->sentinel_counter = 0;
|
2004-09-22 18:57:36 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->grab_resize_timeout_id = 0;
|
|
|
|
display->grab_have_keyboard = FALSE;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->last_bell_time = 0;
|
2006-01-20 22:08:52 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->grab_op = META_GRAB_OP_NONE;
|
|
|
|
display->grab_window = NULL;
|
|
|
|
display->grab_tile_mode = META_TILE_NONE;
|
|
|
|
display->grab_tile_monitor_number = -1;
|
2002-10-07 23:14:40 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->grab_edge_resistance_data = NULL;
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
|
2002-12-10 03:23:04 +00:00
|
|
|
{
|
|
|
|
int major, minor;
|
2004-08-27 02:17:49 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->have_xsync = FALSE;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->xsync_error_base = 0;
|
|
|
|
display->xsync_event_base = 0;
|
2002-12-10 03:23:04 +00:00
|
|
|
|
|
|
|
/* I don't think we really have to fill these in */
|
|
|
|
major = SYNC_MAJOR_VERSION;
|
|
|
|
minor = SYNC_MINOR_VERSION;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
if (!XSyncQueryExtension (display->xdisplay,
|
|
|
|
&display->xsync_event_base,
|
|
|
|
&display->xsync_error_base) ||
|
|
|
|
!XSyncInitialize (display->xdisplay,
|
2002-12-10 03:23:04 +00:00
|
|
|
&major, &minor))
|
|
|
|
{
|
2014-07-10 21:58:58 +00:00
|
|
|
display->xsync_error_base = 0;
|
|
|
|
display->xsync_event_base = 0;
|
2002-12-10 03:23:04 +00:00
|
|
|
}
|
2004-08-27 02:17:49 +00:00
|
|
|
else
|
2012-11-12 18:43:28 +00:00
|
|
|
{
|
2014-07-10 21:58:58 +00:00
|
|
|
display->have_xsync = TRUE;
|
|
|
|
XSyncSetPriority (display->xdisplay, None, 10);
|
2012-11-12 18:43:28 +00:00
|
|
|
}
|
|
|
|
|
2002-12-10 03:23:04 +00:00
|
|
|
meta_verbose ("Attempted to init Xsync, found version %d.%d error base %d event base %d\n",
|
|
|
|
major, minor,
|
2014-07-10 21:58:58 +00:00
|
|
|
display->xsync_error_base,
|
|
|
|
display->xsync_event_base);
|
2002-12-10 03:23:04 +00:00
|
|
|
}
|
2003-01-05 07:51:02 +00:00
|
|
|
|
|
|
|
{
|
2014-07-10 21:58:58 +00:00
|
|
|
display->have_shape = FALSE;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->shape_error_base = 0;
|
|
|
|
display->shape_event_base = 0;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
if (!XShapeQueryExtension (display->xdisplay,
|
|
|
|
&display->shape_event_base,
|
|
|
|
&display->shape_error_base))
|
2003-01-05 07:51:02 +00:00
|
|
|
{
|
2014-07-10 21:58:58 +00:00
|
|
|
display->shape_error_base = 0;
|
|
|
|
display->shape_event_base = 0;
|
2003-01-05 07:51:02 +00:00
|
|
|
}
|
2004-08-27 02:17:49 +00:00
|
|
|
else
|
2014-07-10 21:58:58 +00:00
|
|
|
display->have_shape = TRUE;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2003-01-05 07:51:02 +00:00
|
|
|
meta_verbose ("Attempted to init Shape, found error base %d event base %d\n",
|
2014-07-10 21:58:58 +00:00
|
|
|
display->shape_error_base,
|
|
|
|
display->shape_event_base);
|
2003-01-05 07:51:02 +00:00
|
|
|
}
|
2003-11-21 02:32:05 +00:00
|
|
|
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
{
|
2014-07-10 21:58:58 +00:00
|
|
|
display->have_composite = FALSE;
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->composite_error_base = 0;
|
|
|
|
display->composite_event_base = 0;
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
if (!XCompositeQueryExtension (display->xdisplay,
|
|
|
|
&display->composite_event_base,
|
|
|
|
&display->composite_error_base))
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
{
|
2014-07-10 21:58:58 +00:00
|
|
|
display->composite_error_base = 0;
|
|
|
|
display->composite_event_base = 0;
|
2014-05-02 13:34:02 +00:00
|
|
|
}
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
else
|
2008-02-04 15:57:07 +00:00
|
|
|
{
|
2014-07-10 21:58:58 +00:00
|
|
|
display->composite_major_version = 0;
|
|
|
|
display->composite_minor_version = 0;
|
|
|
|
if (XCompositeQueryVersion (display->xdisplay,
|
|
|
|
&display->composite_major_version,
|
|
|
|
&display->composite_minor_version))
|
2008-02-04 15:57:07 +00:00
|
|
|
{
|
2014-07-10 21:58:58 +00:00
|
|
|
display->have_composite = TRUE;
|
2008-02-04 15:57:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-07-10 21:58:58 +00:00
|
|
|
display->composite_major_version = 0;
|
|
|
|
display->composite_minor_version = 0;
|
2008-02-04 15:57:07 +00:00
|
|
|
}
|
|
|
|
}
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
2008-02-04 15:57:07 +00:00
|
|
|
meta_verbose ("Attempted to init Composite, found error base %d event base %d "
|
|
|
|
"extn ver %d %d\n",
|
2014-07-10 21:58:58 +00:00
|
|
|
display->composite_error_base,
|
|
|
|
display->composite_event_base,
|
|
|
|
display->composite_major_version,
|
|
|
|
display->composite_minor_version);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->have_damage = FALSE;
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->damage_error_base = 0;
|
|
|
|
display->damage_event_base = 0;
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
if (!XDamageQueryExtension (display->xdisplay,
|
|
|
|
&display->damage_event_base,
|
|
|
|
&display->damage_error_base))
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
{
|
2014-07-10 21:58:58 +00:00
|
|
|
display->damage_error_base = 0;
|
|
|
|
display->damage_event_base = 0;
|
2014-05-02 13:34:02 +00:00
|
|
|
}
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
else
|
2014-07-10 21:58:58 +00:00
|
|
|
display->have_damage = TRUE;
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
|
|
|
meta_verbose ("Attempted to init Damage, found error base %d event base %d\n",
|
2014-07-10 21:58:58 +00:00
|
|
|
display->damage_error_base,
|
|
|
|
display->damage_event_base);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->xfixes_error_base = 0;
|
|
|
|
display->xfixes_event_base = 0;
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
if (XFixesQueryExtension (display->xdisplay,
|
|
|
|
&display->xfixes_event_base,
|
|
|
|
&display->xfixes_error_base))
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
{
|
2012-07-30 19:02:56 +00:00
|
|
|
int xfixes_major, xfixes_minor;
|
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
XFixesQueryVersion (display->xdisplay, &xfixes_major, &xfixes_minor);
|
2012-07-30 19:02:56 +00:00
|
|
|
|
|
|
|
if (xfixes_major * 100 + xfixes_minor < 500)
|
|
|
|
meta_fatal ("Mutter requires XFixes 5.0");
|
|
|
|
}
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
else
|
2012-07-30 19:02:56 +00:00
|
|
|
{
|
|
|
|
meta_fatal ("Mutter requires XFixes 5.0");
|
|
|
|
}
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
|
|
|
meta_verbose ("Attempted to init XFixes, found error base %d event base %d\n",
|
2014-07-10 21:58:58 +00:00
|
|
|
display->xfixes_error_base,
|
|
|
|
display->xfixes_event_base);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
}
|
2012-11-15 20:57:08 +00:00
|
|
|
|
|
|
|
{
|
2013-01-30 13:51:18 +00:00
|
|
|
int major = 2, minor = 3;
|
2012-11-15 20:57:08 +00:00
|
|
|
gboolean has_xi = FALSE;
|
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
if (XQueryExtension (display->xdisplay,
|
2012-11-15 20:57:08 +00:00
|
|
|
"XInputExtension",
|
2014-07-10 21:58:58 +00:00
|
|
|
&display->xinput_opcode,
|
|
|
|
&display->xinput_error_base,
|
|
|
|
&display->xinput_event_base))
|
2012-11-15 20:57:08 +00:00
|
|
|
{
|
2014-07-10 21:58:58 +00:00
|
|
|
if (XIQueryVersion (display->xdisplay, &major, &minor) == Success)
|
2012-07-30 18:57:53 +00:00
|
|
|
{
|
|
|
|
int version = (major * 10) + minor;
|
|
|
|
if (version >= 22)
|
|
|
|
has_xi = TRUE;
|
|
|
|
|
|
|
|
#ifdef HAVE_XI23
|
|
|
|
if (version >= 23)
|
2014-07-10 21:58:58 +00:00
|
|
|
display->have_xinput_23 = TRUE;
|
2012-07-30 18:57:53 +00:00
|
|
|
#endif /* HAVE_XI23 */
|
|
|
|
}
|
2012-11-15 20:57:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!has_xi)
|
|
|
|
meta_fatal ("X server doesn't have the XInput extension, version 2.2 or newer\n");
|
|
|
|
}
|
|
|
|
|
2014-04-24 14:48:47 +00:00
|
|
|
update_cursor_theme ();
|
2005-07-11 13:25:08 +00:00
|
|
|
|
2003-11-24 17:47:48 +00:00
|
|
|
/* Create the leader window here. Set its properties and
|
|
|
|
* use the timestamp from one of the PropertyNotify events
|
|
|
|
* that will follow.
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
gulong data[1];
|
|
|
|
XEvent event;
|
|
|
|
|
2007-03-31 23:34:36 +00:00
|
|
|
/* We only care about the PropertyChangeMask in the next 30 or so lines of
|
|
|
|
* code. Note that gdk will at some point unset the PropertyChangeMask for
|
|
|
|
* this window, so we can't rely on it still being set later. See bug
|
|
|
|
* 354213 for details.
|
|
|
|
*/
|
2014-07-10 21:58:58 +00:00
|
|
|
display->leader_window =
|
|
|
|
meta_create_offscreen_window (display->xdisplay,
|
|
|
|
DefaultRootWindow (display->xdisplay),
|
2007-03-31 23:34:36 +00:00
|
|
|
PropertyChangeMask);
|
2003-11-24 17:47:48 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
meta_prop_set_utf8_string_hint (display,
|
|
|
|
display->leader_window,
|
|
|
|
display->atom__NET_WM_NAME,
|
2011-10-20 14:22:35 +00:00
|
|
|
net_wm_name);
|
2009-09-03 18:43:49 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
meta_prop_set_utf8_string_hint (display,
|
|
|
|
display->leader_window,
|
|
|
|
display->atom__GNOME_WM_KEYBINDINGS,
|
2011-10-20 14:22:35 +00:00
|
|
|
gnome_wm_keybindings);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
meta_prop_set_utf8_string_hint (display,
|
|
|
|
display->leader_window,
|
|
|
|
display->atom__MUTTER_VERSION,
|
2005-10-03 18:13:45 +00:00
|
|
|
VERSION);
|
2005-02-07 04:37:35 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
data[0] = display->leader_window;
|
|
|
|
XChangeProperty (display->xdisplay,
|
|
|
|
display->leader_window,
|
|
|
|
display->atom__NET_SUPPORTING_WM_CHECK,
|
2003-11-24 17:47:48 +00:00
|
|
|
XA_WINDOW,
|
|
|
|
32, PropModeReplace, (guchar*) data, 1);
|
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
XWindowEvent (display->xdisplay,
|
|
|
|
display->leader_window,
|
2003-11-24 17:47:48 +00:00
|
|
|
PropertyChangeMask,
|
|
|
|
&event);
|
|
|
|
|
|
|
|
timestamp = event.xproperty.time;
|
2007-03-31 23:34:36 +00:00
|
|
|
|
|
|
|
/* Make it painfully clear that we can't rely on PropertyNotify events on
|
|
|
|
* this window, as per bug 354213.
|
|
|
|
*/
|
2014-07-10 21:58:58 +00:00
|
|
|
XSelectInput(display->xdisplay,
|
|
|
|
display->leader_window,
|
2007-03-31 23:34:36 +00:00
|
|
|
NoEventMask);
|
2003-11-24 17:47:48 +00:00
|
|
|
}
|
|
|
|
|
2007-03-31 05:19:41 +00:00
|
|
|
/* Make a little window used only for pinging the server for timestamps; note
|
|
|
|
* that meta_create_offscreen_window already selects for PropertyChangeMask.
|
|
|
|
*/
|
2014-07-10 21:58:58 +00:00
|
|
|
display->timestamp_pinging_window =
|
|
|
|
meta_create_offscreen_window (display->xdisplay,
|
|
|
|
DefaultRootWindow (display->xdisplay),
|
2007-03-31 23:34:36 +00:00
|
|
|
PropertyChangeMask);
|
2007-03-31 05:19:41 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->last_focus_time = timestamp;
|
|
|
|
display->last_user_time = timestamp;
|
|
|
|
display->compositor = NULL;
|
2013-10-03 22:31:09 +00:00
|
|
|
|
2012-09-10 18:19:21 +00:00
|
|
|
/* Mutter used to manage all X screens of the display in a single process, but
|
|
|
|
* now it always manages exactly one screen as specified by the DISPLAY
|
2013-10-03 22:31:09 +00:00
|
|
|
* environment variable.
|
2012-09-10 18:19:21 +00:00
|
|
|
*/
|
|
|
|
i = meta_ui_get_screen_number ();
|
2014-07-10 21:58:58 +00:00
|
|
|
screen = meta_screen_new (display, i, timestamp);
|
2012-09-10 18:19:21 +00:00
|
|
|
|
2014-02-08 00:52:34 +00:00
|
|
|
if (!screen)
|
2002-10-07 23:14:40 +00:00
|
|
|
{
|
|
|
|
/* This would typically happen because all the screens already
|
|
|
|
* have window managers.
|
|
|
|
*/
|
2014-07-10 21:58:58 +00:00
|
|
|
meta_display_close (display, timestamp);
|
2002-10-07 23:14:40 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
display->screen = screen;
|
2014-02-02 04:09:53 +00:00
|
|
|
|
2014-07-10 15:24:32 +00:00
|
|
|
meta_screen_init_workspaces (screen);
|
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
enable_compositor (display);
|
2006-01-13 19:41:01 +00:00
|
|
|
|
2014-02-08 00:52:34 +00:00
|
|
|
meta_screen_create_guard_window (screen);
|
|
|
|
|
2014-06-19 20:28:48 +00:00
|
|
|
/* Set up touch support */
|
2014-07-10 21:58:58 +00:00
|
|
|
display->gesture_tracker = meta_gesture_tracker_new ();
|
|
|
|
g_signal_connect (display->gesture_tracker, "state-changed",
|
|
|
|
G_CALLBACK (gesture_tracker_state_changed), display);
|
2014-06-19 20:28:48 +00:00
|
|
|
|
2014-02-08 00:52:34 +00:00
|
|
|
/* We know that if mutter is running as a Wayland compositor,
|
|
|
|
* we start out with no windows.
|
|
|
|
*/
|
|
|
|
if (!meta_is_wayland_compositor ())
|
|
|
|
meta_screen_manage_all_windows (screen);
|
2002-07-24 15:41:44 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
Window focus;
|
|
|
|
int ret_to;
|
|
|
|
|
|
|
|
/* kinda bogus because GetInputFocus has no possible errors */
|
2014-07-10 21:58:58 +00:00
|
|
|
meta_error_trap_push (display);
|
2002-07-24 15:41:44 +00:00
|
|
|
|
2004-12-23 06:44:56 +00:00
|
|
|
/* FIXME: This is totally broken; see comment 9 of bug 88194 about this */
|
2002-07-24 15:41:44 +00:00
|
|
|
focus = None;
|
2002-11-22 06:00:18 +00:00
|
|
|
ret_to = RevertToPointerRoot;
|
2014-07-10 21:58:58 +00:00
|
|
|
XGetInputFocus (display->xdisplay, &focus, &ret_to);
|
2002-07-24 15:41:44 +00:00
|
|
|
|
|
|
|
/* Force a new FocusIn (does this work?) */
|
2003-09-27 02:40:09 +00:00
|
|
|
|
2003-11-24 17:47:48 +00:00
|
|
|
/* Use the same timestamp that was passed to meta_screen_new(),
|
|
|
|
* as it is the most recent timestamp.
|
|
|
|
*/
|
2004-12-23 06:44:56 +00:00
|
|
|
if (focus == None || focus == PointerRoot)
|
2005-12-28 06:24:30 +00:00
|
|
|
/* Just focus the no_focus_window on the first screen */
|
2014-07-10 21:58:58 +00:00
|
|
|
meta_display_focus_the_no_focus_window (display,
|
|
|
|
display->screen,
|
2005-12-28 06:24:30 +00:00
|
|
|
timestamp);
|
2004-12-23 06:44:56 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
MetaWindow * window;
|
2014-07-10 21:58:58 +00:00
|
|
|
window = meta_display_lookup_x_window (display, focus);
|
2004-12-23 06:44:56 +00:00
|
|
|
if (window)
|
2014-07-10 21:58:58 +00:00
|
|
|
meta_display_set_input_focus_window (display, window, FALSE, timestamp);
|
2004-12-23 06:44:56 +00:00
|
|
|
else
|
2005-12-28 06:24:30 +00:00
|
|
|
/* Just focus the no_focus_window on the first screen */
|
2014-07-10 21:58:58 +00:00
|
|
|
meta_display_focus_the_no_focus_window (display,
|
|
|
|
display->screen,
|
2005-12-28 06:24:30 +00:00
|
|
|
timestamp);
|
2004-12-23 06:44:56 +00:00
|
|
|
}
|
|
|
|
|
2014-07-10 21:58:58 +00:00
|
|
|
meta_error_trap_pop (display);
|
2002-07-24 15:41:44 +00:00
|
|
|
}
|
2013-08-14 11:51:05 +00:00
|
|
|
|
|
|
|
meta_idle_monitor_init_dbus ();
|
|
|
|
|
2006-10-01 21:59:09 +00:00
|
|
|
/* Done opening new display */
|
2014-07-10 21:58:58 +00:00
|
|
|
display->display_opening = FALSE;
|
2006-10-01 21:59:09 +00:00
|
|
|
|
2001-05-30 15:36:31 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2001-06-03 18:33:59 +00:00
|
|
|
static gint
|
|
|
|
ptrcmp (gconstpointer a, gconstpointer b)
|
|
|
|
{
|
|
|
|
if (a < b)
|
|
|
|
return -1;
|
|
|
|
else if (a > b)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
2001-05-30 15:36:31 +00:00
|
|
|
}
|
|
|
|
|
2009-06-15 19:32:23 +00:00
|
|
|
/**
|
|
|
|
* meta_display_list_windows:
|
|
|
|
* @display: a #MetaDisplay
|
|
|
|
* @flags: options for listing
|
|
|
|
*
|
|
|
|
* Lists windows for the display, the @flags parameter for
|
|
|
|
* now determines whether override-redirect windows will be
|
|
|
|
* included.
|
|
|
|
*
|
|
|
|
* Return value: (transfer container): the list of windows.
|
|
|
|
*/
|
2001-06-24 08:09:10 +00:00
|
|
|
GSList*
|
2009-06-15 19:32:23 +00:00
|
|
|
meta_display_list_windows (MetaDisplay *display,
|
|
|
|
MetaListWindowsFlags flags)
|
2001-05-30 15:36:31 +00:00
|
|
|
{
|
2001-06-03 18:33:59 +00:00
|
|
|
GSList *winlist;
|
2001-06-24 08:09:10 +00:00
|
|
|
GSList *prev;
|
2013-10-03 22:31:09 +00:00
|
|
|
GSList *tmp;
|
2009-06-15 19:32:23 +00:00
|
|
|
GHashTableIter iter;
|
|
|
|
gpointer key, value;
|
|
|
|
|
2001-06-03 18:33:59 +00:00
|
|
|
winlist = NULL;
|
2009-06-15 19:32:23 +00:00
|
|
|
|
2013-02-06 22:02:59 +00:00
|
|
|
g_hash_table_iter_init (&iter, display->xids);
|
2009-06-15 19:32:23 +00:00
|
|
|
while (g_hash_table_iter_next (&iter, &key, &value))
|
|
|
|
{
|
|
|
|
MetaWindow *window = value;
|
|
|
|
|
2012-07-30 18:57:53 +00:00
|
|
|
if (!META_IS_WINDOW (window))
|
|
|
|
continue;
|
|
|
|
|
2009-06-15 19:32:23 +00:00
|
|
|
if (!window->override_redirect ||
|
|
|
|
(flags & META_LIST_INCLUDE_OVERRIDE_REDIRECT) != 0)
|
|
|
|
winlist = g_slist_prepend (winlist, window);
|
|
|
|
}
|
2001-06-03 18:33:59 +00:00
|
|
|
|
2013-09-16 09:24:01 +00:00
|
|
|
g_hash_table_iter_init (&iter, display->wayland_windows);
|
|
|
|
while (g_hash_table_iter_next (&iter, &key, &value))
|
|
|
|
{
|
|
|
|
MetaWindow *window = value;
|
|
|
|
|
|
|
|
if (!META_IS_WINDOW (window))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (!window->override_redirect ||
|
|
|
|
(flags & META_LIST_INCLUDE_OVERRIDE_REDIRECT) != 0)
|
|
|
|
winlist = g_slist_prepend (winlist, window);
|
|
|
|
}
|
|
|
|
|
2001-06-24 08:09:10 +00:00
|
|
|
/* Uniquify the list, since both frame windows and plain
|
|
|
|
* windows are in the hash
|
|
|
|
*/
|
2001-06-03 18:33:59 +00:00
|
|
|
winlist = g_slist_sort (winlist, ptrcmp);
|
|
|
|
|
2001-06-24 08:09:10 +00:00
|
|
|
prev = NULL;
|
|
|
|
tmp = winlist;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
GSList *next;
|
|
|
|
|
|
|
|
next = tmp->next;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-06-24 08:09:10 +00:00
|
|
|
if (next &&
|
|
|
|
next->data == tmp->data)
|
|
|
|
{
|
|
|
|
/* Delete tmp from list */
|
|
|
|
|
|
|
|
if (prev)
|
|
|
|
prev->next = next;
|
|
|
|
|
|
|
|
if (tmp == winlist)
|
|
|
|
winlist = next;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-06-24 08:09:10 +00:00
|
|
|
g_slist_free_1 (tmp);
|
|
|
|
|
|
|
|
/* leave prev unchanged */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
prev = tmp;
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-06-24 08:09:10 +00:00
|
|
|
tmp = next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return winlist;
|
|
|
|
}
|
|
|
|
|
|
|
|
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_display_close (MetaDisplay *display,
|
|
|
|
guint32 timestamp)
|
2001-06-24 08:09:10 +00:00
|
|
|
{
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-25 03:39:13 +00:00
|
|
|
g_assert (display != NULL);
|
2014-07-13 15:36:34 +00:00
|
|
|
g_assert (display == the_display);
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-25 03:39:13 +00:00
|
|
|
|
2008-03-27 12:32:50 +00:00
|
|
|
if (display->closing != 0)
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-25 03:39:13 +00:00
|
|
|
{
|
2008-03-27 12:32:50 +00:00
|
|
|
/* The display's already been closed. */
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-25 03:39:13 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-06-22 05:11:04 +00:00
|
|
|
display->closing += 1;
|
2002-10-07 23:14:40 +00:00
|
|
|
|
|
|
|
meta_prefs_remove_listener (prefs_changed_callback, display);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2004-10-04 21:09:08 +00:00
|
|
|
meta_display_remove_autoraise_callback (display);
|
2005-01-24 05:58:30 +00:00
|
|
|
|
2014-06-19 21:13:38 +00:00
|
|
|
g_clear_object (&display->gesture_tracker);
|
|
|
|
|
2012-12-04 21:45:35 +00:00
|
|
|
if (display->focus_timeout_id)
|
2012-08-29 02:38:54 +00:00
|
|
|
g_source_remove (display->focus_timeout_id);
|
|
|
|
display->focus_timeout_id = 0;
|
|
|
|
|
2001-06-20 03:01:26 +00:00
|
|
|
/* Stop caring about events */
|
2014-08-15 16:48:55 +00:00
|
|
|
meta_display_free_events_x11 (display);
|
2014-03-20 19:29:30 +00:00
|
|
|
meta_display_free_events (display);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2013-10-03 22:31:09 +00:00
|
|
|
meta_screen_free (display->screen, timestamp);
|
2002-10-25 23:35:50 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_STARTUP_NOTIFICATION
|
|
|
|
if (display->sn_display)
|
|
|
|
{
|
|
|
|
sn_display_unref (display->sn_display);
|
|
|
|
display->sn_display = NULL;
|
|
|
|
}
|
|
|
|
#endif
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2008-11-07 09:57:00 +00:00
|
|
|
/* Must be after all calls to meta_window_unmanage() since they
|
2001-06-04 04:58:22 +00:00
|
|
|
* unregister windows
|
|
|
|
*/
|
2013-02-06 22:02:59 +00:00
|
|
|
g_hash_table_destroy (display->xids);
|
2014-05-07 16:24:43 +00:00
|
|
|
g_hash_table_destroy (display->wayland_windows);
|
2001-06-09 21:58:30 +00:00
|
|
|
|
2001-06-10 19:23:28 +00:00
|
|
|
if (display->leader_window != None)
|
|
|
|
XDestroyWindow (display->xdisplay, display->leader_window);
|
2001-06-20 03:01:26 +00:00
|
|
|
|
2002-08-06 04:11:23 +00:00
|
|
|
XFlush (display->xdisplay);
|
2002-11-03 23:42:21 +00:00
|
|
|
|
|
|
|
meta_display_free_window_prop_hooks (display);
|
2002-12-01 03:58:04 +00:00
|
|
|
meta_display_free_group_prop_hooks (display);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-05-30 15:36:31 +00:00
|
|
|
g_free (display->name);
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
meta_display_shutdown_keys (display);
|
2003-11-21 02:32:05 +00:00
|
|
|
|
2006-05-26 16:51:03 +00:00
|
|
|
if (display->compositor)
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
meta_compositor_destroy (display->compositor);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2009-02-03 09:11:32 +00:00
|
|
|
g_object_unref (display);
|
2009-08-22 19:55:17 +00:00
|
|
|
the_display = NULL;
|
2001-05-30 15:36:31 +00:00
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-25 03:39:13 +00:00
|
|
|
meta_quit (META_EXIT_SUCCESS);
|
2001-05-30 15:36:31 +00:00
|
|
|
}
|
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-25 03:39:13 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* meta_display_for_x_display:
|
|
|
|
* @xdisplay: An X display
|
|
|
|
*
|
|
|
|
* Returns the singleton MetaDisplay if @xdisplay matches the X display it's
|
|
|
|
* managing; otherwise gives a warning and returns %NULL. When we were claiming
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-25 03:39:13 +00:00
|
|
|
* to be able to manage multiple displays, this was supposed to find the
|
|
|
|
* display out of the list which matched that display. Now it's merely an
|
|
|
|
* extra sanity check.
|
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Returns: The singleton X display, or %NULL if @xdisplay isn't the one
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-25 03:39:13 +00:00
|
|
|
* we're managing.
|
|
|
|
*/
|
2001-05-31 03:30:58 +00:00
|
|
|
MetaDisplay*
|
|
|
|
meta_display_for_x_display (Display *xdisplay)
|
|
|
|
{
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-25 03:39:13 +00:00
|
|
|
if (the_display->xdisplay == xdisplay)
|
|
|
|
return the_display;
|
2001-05-31 03:30:58 +00:00
|
|
|
|
2002-03-06 22:27:24 +00:00
|
|
|
meta_warning ("Could not find display for X display %p, probably going to crash\n",
|
|
|
|
xdisplay);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-05-31 03:30:58 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-25 03:39:13 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* meta_get_display:
|
|
|
|
*
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-25 03:39:13 +00:00
|
|
|
* Accessor for the singleton MetaDisplay.
|
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Returns: The only #MetaDisplay there is. This can be %NULL, but only
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-25 03:39:13 +00:00
|
|
|
* during startup.
|
|
|
|
*/
|
|
|
|
MetaDisplay*
|
|
|
|
meta_get_display (void)
|
2001-05-31 06:42:58 +00:00
|
|
|
{
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-25 03:39:13 +00:00
|
|
|
return the_display;
|
2001-05-31 06:42:58 +00:00
|
|
|
}
|
|
|
|
|
2014-04-20 15:41:22 +00:00
|
|
|
gboolean
|
2014-04-20 15:45:38 +00:00
|
|
|
meta_grab_op_is_mouse (MetaGrabOp op)
|
2006-08-21 18:38:21 +00:00
|
|
|
{
|
2014-08-15 18:05:04 +00:00
|
|
|
if (GRAB_OP_GET_BASE_TYPE (op) != META_GRAB_OP_WINDOW_BASE)
|
|
|
|
return FALSE;
|
2006-08-21 18:38:21 +00:00
|
|
|
|
2014-08-15 18:05:04 +00:00
|
|
|
return (op & META_GRAB_OP_WINDOW_FLAG_KEYBOARD) == 0;
|
2006-08-21 18:38:21 +00:00
|
|
|
}
|
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
gboolean
|
|
|
|
meta_grab_op_is_keyboard (MetaGrabOp op)
|
2001-07-26 03:14:45 +00:00
|
|
|
{
|
2014-08-15 18:05:04 +00:00
|
|
|
if (GRAB_OP_GET_BASE_TYPE (op) == META_GRAB_OP_WINDOW_BASE)
|
|
|
|
return FALSE;
|
2001-07-26 03:14:45 +00:00
|
|
|
|
2014-08-15 18:05:04 +00:00
|
|
|
return (op & META_GRAB_OP_WINDOW_FLAG_KEYBOARD) != 0;
|
2001-07-26 03:14:45 +00:00
|
|
|
}
|
|
|
|
|
2002-12-10 03:23:04 +00:00
|
|
|
gboolean
|
|
|
|
meta_grab_op_is_resizing (MetaGrabOp op)
|
|
|
|
{
|
2014-08-15 18:05:04 +00:00
|
|
|
if (GRAB_OP_GET_BASE_TYPE (op) != META_GRAB_OP_WINDOW_BASE)
|
|
|
|
return FALSE;
|
2002-12-10 03:23:04 +00:00
|
|
|
|
2014-08-15 18:05:04 +00:00
|
|
|
return (op & 0xF000) != 0;
|
2002-12-10 03:23:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_grab_op_is_moving (MetaGrabOp op)
|
|
|
|
{
|
2014-08-15 18:05:04 +00:00
|
|
|
if (GRAB_OP_GET_BASE_TYPE (op) != META_GRAB_OP_WINDOW_BASE)
|
|
|
|
return FALSE;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2014-08-15 18:05:04 +00:00
|
|
|
return (op & 0xF000) != 0;
|
2002-12-10 03:23:04 +00:00
|
|
|
}
|
|
|
|
|
2014-04-20 15:43:10 +00:00
|
|
|
gboolean
|
|
|
|
meta_grab_op_is_moving_or_resizing (MetaGrabOp op)
|
|
|
|
{
|
2014-08-15 18:05:04 +00:00
|
|
|
return GRAB_OP_GET_BASE_TYPE (op) == META_GRAB_OP_WINDOW_BASE;
|
2014-04-20 15:43:10 +00:00
|
|
|
}
|
|
|
|
|
2014-04-12 07:13:57 +00:00
|
|
|
/**
|
2014-08-15 17:30:31 +00:00
|
|
|
* meta_grab_op_windows_are_interactable:
|
2014-04-12 07:13:57 +00:00
|
|
|
* @op: A #MetaGrabOp
|
|
|
|
*
|
2014-08-15 17:12:22 +00:00
|
|
|
* Whether windows can be interacted with.
|
2014-04-12 07:13:57 +00:00
|
|
|
*/
|
2014-03-17 19:53:19 +00:00
|
|
|
gboolean
|
2014-08-15 17:12:22 +00:00
|
|
|
meta_display_windows_are_interactable (MetaDisplay *display)
|
2014-03-17 19:53:19 +00:00
|
|
|
{
|
2014-08-15 17:12:22 +00:00
|
|
|
switch (display->event_route)
|
2014-04-24 17:04:15 +00:00
|
|
|
{
|
2014-08-15 17:12:22 +00:00
|
|
|
case META_EVENT_ROUTE_NORMAL:
|
|
|
|
case META_EVENT_ROUTE_WAYLAND_POPUP:
|
2014-04-24 17:04:15 +00:00
|
|
|
return TRUE;
|
2014-08-15 17:30:31 +00:00
|
|
|
default:
|
|
|
|
return FALSE;
|
2014-04-24 17:04:15 +00:00
|
|
|
}
|
2014-03-17 19:53:19 +00:00
|
|
|
}
|
|
|
|
|
2010-04-17 18:43:08 +00:00
|
|
|
/**
|
|
|
|
* meta_display_xserver_time_is_before:
|
|
|
|
* @display: a #MetaDisplay
|
|
|
|
* @time1: An event timestamp
|
|
|
|
* @time2: An event timestamp
|
|
|
|
*
|
|
|
|
* Xserver time can wraparound, thus comparing two timestamps needs to take
|
|
|
|
* this into account. If no wraparound has occurred, this is equivalent to
|
|
|
|
* time1 < time2
|
|
|
|
* Otherwise, we need to account for the fact that wraparound can occur
|
|
|
|
* and the fact that a timestamp of 0 must be special-cased since it
|
|
|
|
* means "older than anything else".
|
|
|
|
*
|
|
|
|
* Note that this is NOT an equivalent for time1 <= time2; if that's what
|
|
|
|
* you need then you'll need to swap the order of the arguments and negate
|
|
|
|
* the result.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
meta_display_xserver_time_is_before (MetaDisplay *display,
|
|
|
|
guint32 time1,
|
|
|
|
guint32 time2)
|
|
|
|
{
|
|
|
|
return XSERVER_TIME_IS_BEFORE(time1, time2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* meta_display_get_last_user_time:
|
|
|
|
* @display: a #MetaDisplay
|
|
|
|
*
|
|
|
|
* Returns: Timestamp of the last user interaction event with a window
|
|
|
|
*/
|
|
|
|
guint32
|
|
|
|
meta_display_get_last_user_time (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
return display->last_user_time;
|
|
|
|
}
|
|
|
|
|
2002-01-03 23:28:19 +00:00
|
|
|
/* Get time of current event, or CurrentTime if none. */
|
|
|
|
guint32
|
|
|
|
meta_display_get_current_time (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
return display->current_time;
|
|
|
|
}
|
|
|
|
|
display: Ensure that we ignore our own focus events for focus predictions
When we set the input focus, we first set the predicted window,
and then try to process focus events. But as XI_FocusOut on the
existing window comes before XI_FocusIn on the new window, we'll
see the focus out on the old window and think the focus is going
to nothing, which makes mutter think the prediction failed.
This didn't really matter as nothing paid attention to the focus
window changing, but with gnome-shell's focus rework, we'll try
and drop keyboard focus in events like these.
Fix this by making sure that we ignore focus window changes of our
own cause when updating the focus window field, by ignoring all
focus events that have a serial the same as the focus request or
lower. Note that if mutter doens't make any requests after the
focus request, this could be racy, as another client could steal
the focus, but mutter would ignore it as the serial was the same.
Bump the serial by making a dummy ChangeProperty request to a
mutter-controlled window in this case.
https://bugzilla.gnome.org/show_bug.cgi?id=701017
2013-05-25 20:09:08 +00:00
|
|
|
static Bool
|
2013-05-24 21:58:55 +00:00
|
|
|
find_timestamp_predicate (Display *xdisplay,
|
display: Ensure that we ignore our own focus events for focus predictions
When we set the input focus, we first set the predicted window,
and then try to process focus events. But as XI_FocusOut on the
existing window comes before XI_FocusIn on the new window, we'll
see the focus out on the old window and think the focus is going
to nothing, which makes mutter think the prediction failed.
This didn't really matter as nothing paid attention to the focus
window changing, but with gnome-shell's focus rework, we'll try
and drop keyboard focus in events like these.
Fix this by making sure that we ignore focus window changes of our
own cause when updating the focus window field, by ignoring all
focus events that have a serial the same as the focus request or
lower. Note that if mutter doens't make any requests after the
focus request, this could be racy, as another client could steal
the focus, but mutter would ignore it as the serial was the same.
Bump the serial by making a dummy ChangeProperty request to a
mutter-controlled window in this case.
https://bugzilla.gnome.org/show_bug.cgi?id=701017
2013-05-25 20:09:08 +00:00
|
|
|
XEvent *ev,
|
|
|
|
XPointer arg)
|
|
|
|
{
|
2013-05-24 21:58:55 +00:00
|
|
|
MetaDisplay *display = (MetaDisplay *) arg;
|
display: Ensure that we ignore our own focus events for focus predictions
When we set the input focus, we first set the predicted window,
and then try to process focus events. But as XI_FocusOut on the
existing window comes before XI_FocusIn on the new window, we'll
see the focus out on the old window and think the focus is going
to nothing, which makes mutter think the prediction failed.
This didn't really matter as nothing paid attention to the focus
window changing, but with gnome-shell's focus rework, we'll try
and drop keyboard focus in events like these.
Fix this by making sure that we ignore focus window changes of our
own cause when updating the focus window field, by ignoring all
focus events that have a serial the same as the focus request or
lower. Note that if mutter doens't make any requests after the
focus request, this could be racy, as another client could steal
the focus, but mutter would ignore it as the serial was the same.
Bump the serial by making a dummy ChangeProperty request to a
mutter-controlled window in this case.
https://bugzilla.gnome.org/show_bug.cgi?id=701017
2013-05-25 20:09:08 +00:00
|
|
|
|
|
|
|
return (ev->type == PropertyNotify &&
|
|
|
|
ev->xproperty.atom == display->atom__MUTTER_TIMESTAMP_PING);
|
|
|
|
}
|
|
|
|
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 20:32:59 +00:00
|
|
|
/* Get a timestamp, even if it means a roundtrip */
|
|
|
|
guint32
|
|
|
|
meta_display_get_current_time_roundtrip (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
guint32 timestamp;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 20:32:59 +00:00
|
|
|
timestamp = meta_display_get_current_time (display);
|
|
|
|
if (timestamp == CurrentTime)
|
|
|
|
{
|
|
|
|
XEvent property_event;
|
|
|
|
|
display: Ensure that we ignore our own focus events for focus predictions
When we set the input focus, we first set the predicted window,
and then try to process focus events. But as XI_FocusOut on the
existing window comes before XI_FocusIn on the new window, we'll
see the focus out on the old window and think the focus is going
to nothing, which makes mutter think the prediction failed.
This didn't really matter as nothing paid attention to the focus
window changing, but with gnome-shell's focus rework, we'll try
and drop keyboard focus in events like these.
Fix this by making sure that we ignore focus window changes of our
own cause when updating the focus window field, by ignoring all
focus events that have a serial the same as the focus request or
lower. Note that if mutter doens't make any requests after the
focus request, this could be racy, as another client could steal
the focus, but mutter would ignore it as the serial was the same.
Bump the serial by making a dummy ChangeProperty request to a
mutter-controlled window in this case.
https://bugzilla.gnome.org/show_bug.cgi?id=701017
2013-05-25 20:09:08 +00:00
|
|
|
XChangeProperty (display->xdisplay, display->timestamp_pinging_window,
|
|
|
|
display->atom__MUTTER_TIMESTAMP_PING,
|
|
|
|
XA_STRING, 8, PropModeAppend, NULL, 0);
|
|
|
|
XIfEvent (display->xdisplay,
|
|
|
|
&property_event,
|
|
|
|
find_timestamp_predicate,
|
2013-05-24 21:58:55 +00:00
|
|
|
(XPointer) display);
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 20:32:59 +00:00
|
|
|
timestamp = property_event.xproperty.time;
|
|
|
|
}
|
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
meta_display_sanity_check_timestamps (display, timestamp);
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 17:14:16 +00:00
|
|
|
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 20:32:59 +00:00
|
|
|
return timestamp;
|
|
|
|
}
|
|
|
|
|
2011-09-07 15:19:15 +00:00
|
|
|
/**
|
|
|
|
* meta_display_add_ignored_crossing_serial:
|
|
|
|
* @display: a #MetaDisplay
|
|
|
|
* @serial: the serial to ignore
|
|
|
|
*
|
|
|
|
* Save the specified serial and ignore crossing events with that
|
|
|
|
* serial for the purpose of focus-follows-mouse. This can be used
|
|
|
|
* for certain changes to the window hierarchy that we don't want
|
|
|
|
* to change the focus window, even if they cause the pointer to
|
|
|
|
* end up in a new window.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
meta_display_add_ignored_crossing_serial (MetaDisplay *display,
|
|
|
|
unsigned long serial)
|
2002-03-02 15:26:07 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* don't add the same serial more than once */
|
2011-09-12 13:50:30 +00:00
|
|
|
if (display->ignored_crossing_serials[N_IGNORED_CROSSING_SERIALS-1] == serial)
|
2002-03-02 15:26:07 +00:00
|
|
|
return;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-03-02 15:26:07 +00:00
|
|
|
/* shift serials to the left */
|
|
|
|
i = 0;
|
2011-09-12 13:50:30 +00:00
|
|
|
while (i < (N_IGNORED_CROSSING_SERIALS - 1))
|
2002-03-02 15:26:07 +00:00
|
|
|
{
|
2011-09-12 13:50:30 +00:00
|
|
|
display->ignored_crossing_serials[i] = display->ignored_crossing_serials[i+1];
|
2002-03-02 15:26:07 +00:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
/* put new one on the end */
|
2011-09-12 13:50:30 +00:00
|
|
|
display->ignored_crossing_serials[i] = serial;
|
2002-03-02 15:26:07 +00:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
static gboolean
|
2002-05-24 02:23:46 +00:00
|
|
|
window_raise_with_delay_callback (void *data)
|
|
|
|
{
|
2013-10-16 04:19:33 +00:00
|
|
|
MetaWindow *window = data;
|
2002-05-24 02:23:46 +00:00
|
|
|
|
2013-10-16 04:19:33 +00:00
|
|
|
window->display->autoraise_timeout_id = 0;
|
|
|
|
window->display->autoraise_window = NULL;
|
2002-05-24 02:23:46 +00:00
|
|
|
|
|
|
|
/* If we aren't already on top, check whether the pointer is inside
|
|
|
|
* the window and raise the window if so.
|
2014-05-02 13:34:02 +00:00
|
|
|
*/
|
|
|
|
if (meta_stack_get_top (window->screen->stack) != window)
|
2002-05-24 02:23:46 +00:00
|
|
|
{
|
2014-06-12 21:01:13 +00:00
|
|
|
if (meta_window_has_pointer (window))
|
2002-05-24 02:23:46 +00:00
|
|
|
meta_window_raise (window);
|
|
|
|
else
|
2014-05-02 13:34:02 +00:00
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Pointer not inside window, not raising %s\n",
|
2002-05-24 02:23:46 +00:00
|
|
|
window->desc);
|
|
|
|
}
|
|
|
|
|
2014-06-12 21:02:14 +00:00
|
|
|
return G_SOURCE_REMOVE;
|
2002-05-24 02:23:46 +00:00
|
|
|
}
|
|
|
|
|
2004-10-04 21:09:08 +00:00
|
|
|
void
|
|
|
|
meta_display_queue_autoraise_callback (MetaDisplay *display,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
2014-05-02 13:34:02 +00:00
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Queuing an autoraise timeout for %s with delay %d\n",
|
|
|
|
window->desc,
|
2004-10-04 21:09:08 +00:00
|
|
|
meta_prefs_get_auto_raise_delay ());
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2004-10-04 21:09:08 +00:00
|
|
|
if (display->autoraise_timeout_id != 0)
|
|
|
|
g_source_remove (display->autoraise_timeout_id);
|
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
display->autoraise_timeout_id =
|
2004-10-04 21:09:08 +00:00
|
|
|
g_timeout_add_full (G_PRIORITY_DEFAULT,
|
|
|
|
meta_prefs_get_auto_raise_delay (),
|
|
|
|
window_raise_with_delay_callback,
|
2013-10-16 04:19:33 +00:00
|
|
|
window, NULL);
|
2014-04-10 16:58:58 +00:00
|
|
|
g_source_set_name_by_id (display->autoraise_timeout_id, "[mutter] window_raise_with_delay_callback");
|
2004-10-04 21:09:08 +00:00
|
|
|
display->autoraise_window = window;
|
|
|
|
}
|
|
|
|
|
2014-03-11 17:45:39 +00:00
|
|
|
void
|
|
|
|
meta_display_sync_wayland_input_focus (MetaDisplay *display)
|
|
|
|
{
|
2014-08-14 00:19:35 +00:00
|
|
|
#ifdef HAVE_WAYLAND
|
2014-03-11 17:45:39 +00:00
|
|
|
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
2014-03-25 15:27:09 +00:00
|
|
|
MetaWindow *focus_window = NULL;
|
2014-03-11 17:45:39 +00:00
|
|
|
|
2014-08-15 17:12:22 +00:00
|
|
|
if (!meta_display_windows_are_interactable (display))
|
2014-03-11 17:45:39 +00:00
|
|
|
focus_window = NULL;
|
|
|
|
else if (meta_display_xwindow_is_a_no_focus_window (display, display->focus_xwindow))
|
|
|
|
focus_window = NULL;
|
|
|
|
else if (display->focus_window && display->focus_window->surface)
|
|
|
|
focus_window = display->focus_window;
|
|
|
|
else
|
|
|
|
meta_topic (META_DEBUG_FOCUS, "Focus change has no effect, because there is no matching wayland surface");
|
|
|
|
|
|
|
|
meta_wayland_compositor_set_input_focus (compositor, focus_window);
|
|
|
|
|
2014-04-17 22:46:14 +00:00
|
|
|
meta_wayland_seat_repick (compositor->seat);
|
2014-08-14 00:19:35 +00:00
|
|
|
#endif
|
2014-03-11 17:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
void
|
|
|
|
meta_display_update_focus_window (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
Window xwindow,
|
|
|
|
gulong serial,
|
|
|
|
gboolean focused_by_us)
|
2011-04-26 12:12:04 +00:00
|
|
|
{
|
|
|
|
display->focus_serial = serial;
|
2013-12-16 21:01:04 +00:00
|
|
|
display->focused_by_us = focused_by_us;
|
2011-04-26 12:12:04 +00:00
|
|
|
|
2013-08-12 16:04:34 +00:00
|
|
|
if (display->focus_xwindow == xwindow &&
|
|
|
|
display->focus_window == window)
|
2011-04-26 12:12:04 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (display->focus_window)
|
|
|
|
{
|
|
|
|
MetaWindow *previous;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"%s is now the previous focus window due to being focused out or unmapped\n",
|
|
|
|
display->focus_window->desc);
|
|
|
|
|
|
|
|
/* Make sure that signals handlers invoked by
|
|
|
|
* meta_window_set_focused_internal() don't see
|
|
|
|
* display->focus_window->has_focus == FALSE
|
|
|
|
*/
|
|
|
|
previous = display->focus_window;
|
|
|
|
display->focus_window = NULL;
|
2013-05-24 21:58:55 +00:00
|
|
|
display->focus_xwindow = None;
|
2011-04-26 12:12:04 +00:00
|
|
|
|
|
|
|
meta_window_set_focused_internal (previous, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
display->focus_window = window;
|
2013-05-24 21:58:55 +00:00
|
|
|
display->focus_xwindow = xwindow;
|
2011-04-26 12:12:04 +00:00
|
|
|
|
|
|
|
if (display->focus_window)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS, "* Focus --> %s with serial %lu\n",
|
|
|
|
display->focus_window->desc, serial);
|
|
|
|
meta_window_set_focused_internal (display->focus_window, TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
meta_topic (META_DEBUG_FOCUS, "* Focus --> NULL with serial %lu\n", serial);
|
|
|
|
|
2013-08-12 16:04:34 +00:00
|
|
|
if (meta_is_wayland_compositor ())
|
2014-03-11 17:45:39 +00:00
|
|
|
meta_display_sync_wayland_input_focus (display);
|
2013-08-12 16:04:34 +00:00
|
|
|
|
2011-04-26 12:12:04 +00:00
|
|
|
g_object_notify (G_OBJECT (display), "focus-window");
|
|
|
|
meta_display_update_active_window_hint (display);
|
|
|
|
}
|
|
|
|
|
2014-03-20 20:06:24 +00:00
|
|
|
gboolean
|
|
|
|
meta_display_timestamp_too_old (MetaDisplay *display,
|
|
|
|
guint32 *timestamp)
|
2013-05-23 19:54:39 +00:00
|
|
|
{
|
|
|
|
/* FIXME: If Soeren's suggestion in bug 151984 is implemented, it will allow
|
|
|
|
* us to sanity check the timestamp here and ensure it doesn't correspond to
|
|
|
|
* a future time (though we would want to rename to
|
|
|
|
* timestamp_too_old_or_in_future).
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (*timestamp == CurrentTime)
|
|
|
|
{
|
|
|
|
*timestamp = meta_display_get_current_time_roundtrip (display);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else if (XSERVER_TIME_IS_BEFORE (*timestamp, display->last_focus_time))
|
|
|
|
{
|
|
|
|
if (XSERVER_TIME_IS_BEFORE (*timestamp, display->last_user_time))
|
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*timestamp = display->last_focus_time;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-02-23 17:28:51 +00:00
|
|
|
request_xserver_input_focus_change (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *meta_window,
|
|
|
|
Window xwindow,
|
|
|
|
guint32 timestamp)
|
2013-05-23 19:54:39 +00:00
|
|
|
{
|
display: Ensure that we ignore our own focus events for focus predictions
When we set the input focus, we first set the predicted window,
and then try to process focus events. But as XI_FocusOut on the
existing window comes before XI_FocusIn on the new window, we'll
see the focus out on the old window and think the focus is going
to nothing, which makes mutter think the prediction failed.
This didn't really matter as nothing paid attention to the focus
window changing, but with gnome-shell's focus rework, we'll try
and drop keyboard focus in events like these.
Fix this by making sure that we ignore focus window changes of our
own cause when updating the focus window field, by ignoring all
focus events that have a serial the same as the focus request or
lower. Note that if mutter doens't make any requests after the
focus request, this could be racy, as another client could steal
the focus, but mutter would ignore it as the serial was the same.
Bump the serial by making a dummy ChangeProperty request to a
mutter-controlled window in this case.
https://bugzilla.gnome.org/show_bug.cgi?id=701017
2013-05-25 20:09:08 +00:00
|
|
|
gulong serial;
|
2013-05-23 19:54:39 +00:00
|
|
|
|
2014-03-20 20:06:24 +00:00
|
|
|
if (meta_display_timestamp_too_old (display, ×tamp))
|
2013-05-23 19:54:39 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
meta_error_trap_push (display);
|
display: Ensure that we ignore our own focus events for focus predictions
When we set the input focus, we first set the predicted window,
and then try to process focus events. But as XI_FocusOut on the
existing window comes before XI_FocusIn on the new window, we'll
see the focus out on the old window and think the focus is going
to nothing, which makes mutter think the prediction failed.
This didn't really matter as nothing paid attention to the focus
window changing, but with gnome-shell's focus rework, we'll try
and drop keyboard focus in events like these.
Fix this by making sure that we ignore focus window changes of our
own cause when updating the focus window field, by ignoring all
focus events that have a serial the same as the focus request or
lower. Note that if mutter doens't make any requests after the
focus request, this could be racy, as another client could steal
the focus, but mutter would ignore it as the serial was the same.
Bump the serial by making a dummy ChangeProperty request to a
mutter-controlled window in this case.
https://bugzilla.gnome.org/show_bug.cgi?id=701017
2013-05-25 20:09:08 +00:00
|
|
|
|
|
|
|
/* In order for mutter to know that the focus request succeeded, we track
|
|
|
|
* the serial of the "focus request" we made, but if we take the serial
|
|
|
|
* of the XSetInputFocus request, then there's no way to determine the
|
|
|
|
* difference between focus events as a result of the SetInputFocus and
|
|
|
|
* focus events that other clients send around the same time. Ensure that
|
|
|
|
* we know which is which by making two requests that the server will
|
|
|
|
* process at the same time.
|
|
|
|
*/
|
2014-07-11 17:32:07 +00:00
|
|
|
XGrabServer (display->xdisplay);
|
display: Ensure that we ignore our own focus events for focus predictions
When we set the input focus, we first set the predicted window,
and then try to process focus events. But as XI_FocusOut on the
existing window comes before XI_FocusIn on the new window, we'll
see the focus out on the old window and think the focus is going
to nothing, which makes mutter think the prediction failed.
This didn't really matter as nothing paid attention to the focus
window changing, but with gnome-shell's focus rework, we'll try
and drop keyboard focus in events like these.
Fix this by making sure that we ignore focus window changes of our
own cause when updating the focus window field, by ignoring all
focus events that have a serial the same as the focus request or
lower. Note that if mutter doens't make any requests after the
focus request, this could be racy, as another client could steal
the focus, but mutter would ignore it as the serial was the same.
Bump the serial by making a dummy ChangeProperty request to a
mutter-controlled window in this case.
https://bugzilla.gnome.org/show_bug.cgi?id=701017
2013-05-25 20:09:08 +00:00
|
|
|
|
|
|
|
serial = XNextRequest (display->xdisplay);
|
2013-05-23 19:54:39 +00:00
|
|
|
|
|
|
|
XSetInputFocus (display->xdisplay,
|
|
|
|
xwindow,
|
|
|
|
RevertToPointerRoot,
|
|
|
|
timestamp);
|
display: Ensure that we ignore our own focus events for focus predictions
When we set the input focus, we first set the predicted window,
and then try to process focus events. But as XI_FocusOut on the
existing window comes before XI_FocusIn on the new window, we'll
see the focus out on the old window and think the focus is going
to nothing, which makes mutter think the prediction failed.
This didn't really matter as nothing paid attention to the focus
window changing, but with gnome-shell's focus rework, we'll try
and drop keyboard focus in events like these.
Fix this by making sure that we ignore focus window changes of our
own cause when updating the focus window field, by ignoring all
focus events that have a serial the same as the focus request or
lower. Note that if mutter doens't make any requests after the
focus request, this could be racy, as another client could steal
the focus, but mutter would ignore it as the serial was the same.
Bump the serial by making a dummy ChangeProperty request to a
mutter-controlled window in this case.
https://bugzilla.gnome.org/show_bug.cgi?id=701017
2013-05-25 20:09:08 +00:00
|
|
|
|
|
|
|
XChangeProperty (display->xdisplay, display->timestamp_pinging_window,
|
|
|
|
display->atom__MUTTER_FOCUS_SET,
|
|
|
|
XA_STRING, 8, PropModeAppend, NULL, 0);
|
|
|
|
|
2014-07-11 17:32:07 +00:00
|
|
|
XUngrabServer (display->xdisplay);
|
|
|
|
XFlush (display->xdisplay);
|
display: Ensure that we ignore our own focus events for focus predictions
When we set the input focus, we first set the predicted window,
and then try to process focus events. But as XI_FocusOut on the
existing window comes before XI_FocusIn on the new window, we'll
see the focus out on the old window and think the focus is going
to nothing, which makes mutter think the prediction failed.
This didn't really matter as nothing paid attention to the focus
window changing, but with gnome-shell's focus rework, we'll try
and drop keyboard focus in events like these.
Fix this by making sure that we ignore focus window changes of our
own cause when updating the focus window field, by ignoring all
focus events that have a serial the same as the focus request or
lower. Note that if mutter doens't make any requests after the
focus request, this could be racy, as another client could steal
the focus, but mutter would ignore it as the serial was the same.
Bump the serial by making a dummy ChangeProperty request to a
mutter-controlled window in this case.
https://bugzilla.gnome.org/show_bug.cgi?id=701017
2013-05-25 20:09:08 +00:00
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
meta_display_update_focus_window (display,
|
|
|
|
meta_window,
|
|
|
|
xwindow,
|
|
|
|
serial,
|
|
|
|
TRUE);
|
display: Ensure that we ignore our own focus events for focus predictions
When we set the input focus, we first set the predicted window,
and then try to process focus events. But as XI_FocusOut on the
existing window comes before XI_FocusIn on the new window, we'll
see the focus out on the old window and think the focus is going
to nothing, which makes mutter think the prediction failed.
This didn't really matter as nothing paid attention to the focus
window changing, but with gnome-shell's focus rework, we'll try
and drop keyboard focus in events like these.
Fix this by making sure that we ignore focus window changes of our
own cause when updating the focus window field, by ignoring all
focus events that have a serial the same as the focus request or
lower. Note that if mutter doens't make any requests after the
focus request, this could be racy, as another client could steal
the focus, but mutter would ignore it as the serial was the same.
Bump the serial by making a dummy ChangeProperty request to a
mutter-controlled window in this case.
https://bugzilla.gnome.org/show_bug.cgi?id=701017
2013-05-25 20:09:08 +00:00
|
|
|
|
2013-05-23 19:54:39 +00:00
|
|
|
meta_error_trap_pop (display);
|
|
|
|
|
|
|
|
display->last_focus_time = timestamp;
|
|
|
|
|
|
|
|
if (meta_window == NULL || meta_window != display->autoraise_window)
|
|
|
|
meta_display_remove_autoraise_callback (display);
|
|
|
|
}
|
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
MetaWindow*
|
|
|
|
meta_display_lookup_x_window (MetaDisplay *display,
|
|
|
|
Window xwindow)
|
2011-04-26 12:12:04 +00:00
|
|
|
{
|
2014-03-20 19:29:30 +00:00
|
|
|
return g_hash_table_lookup (display->xids, &xwindow);
|
|
|
|
}
|
2011-04-26 12:12:04 +00:00
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
void
|
|
|
|
meta_display_register_x_window (MetaDisplay *display,
|
|
|
|
Window *xwindowp,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (g_hash_table_lookup (display->xids, xwindowp) == NULL);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
g_hash_table_insert (display->xids, xwindowp, window);
|
2011-04-26 12:12:04 +00:00
|
|
|
}
|
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
void
|
|
|
|
meta_display_unregister_x_window (MetaDisplay *display,
|
|
|
|
Window xwindow)
|
2013-11-25 20:13:48 +00:00
|
|
|
{
|
2014-03-20 19:29:30 +00:00
|
|
|
g_return_if_fail (g_hash_table_lookup (display->xids, &xwindow) != NULL);
|
2013-11-25 20:13:48 +00:00
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
g_hash_table_remove (display->xids, &xwindow);
|
2013-11-25 20:13:48 +00:00
|
|
|
}
|
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
void
|
|
|
|
meta_display_register_wayland_window (MetaDisplay *display,
|
|
|
|
MetaWindow *window)
|
2013-10-03 19:23:24 +00:00
|
|
|
{
|
2014-03-20 19:29:30 +00:00
|
|
|
g_hash_table_add (display->wayland_windows, window);
|
|
|
|
}
|
2013-10-03 19:23:24 +00:00
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
void
|
|
|
|
meta_display_unregister_wayland_window (MetaDisplay *display,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
|
|
|
g_hash_table_remove (display->wayland_windows, window);
|
|
|
|
}
|
2013-10-03 19:23:24 +00:00
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
/* We store sync alarms in the window ID hash table, because they are
|
|
|
|
* just more types of XIDs in the same global space, but we have
|
|
|
|
* typesafe functions to register/unregister for readability.
|
|
|
|
*/
|
2013-10-03 19:23:24 +00:00
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
MetaWindow*
|
|
|
|
meta_display_lookup_sync_alarm (MetaDisplay *display,
|
|
|
|
XSyncAlarm alarm)
|
|
|
|
{
|
|
|
|
return g_hash_table_lookup (display->xids, &alarm);
|
|
|
|
}
|
2013-10-03 19:23:24 +00:00
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
void
|
|
|
|
meta_display_register_sync_alarm (MetaDisplay *display,
|
|
|
|
XSyncAlarm *alarmp,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (g_hash_table_lookup (display->xids, alarmp) == NULL);
|
2013-10-03 19:23:24 +00:00
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
g_hash_table_insert (display->xids, alarmp, window);
|
|
|
|
}
|
2013-10-03 19:23:24 +00:00
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
void
|
|
|
|
meta_display_unregister_sync_alarm (MetaDisplay *display,
|
|
|
|
XSyncAlarm alarm)
|
|
|
|
{
|
|
|
|
g_return_if_fail (g_hash_table_lookup (display->xids, &alarm) != NULL);
|
2013-10-03 19:23:24 +00:00
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
g_hash_table_remove (display->xids, &alarm);
|
|
|
|
}
|
2013-10-03 19:29:44 +00:00
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
void
|
|
|
|
meta_display_notify_window_created (MetaDisplay *display,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
|
|
|
g_signal_emit (display, display_signals[WINDOW_CREATED], 0, window);
|
|
|
|
}
|
2013-10-03 22:03:53 +00:00
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
/**
|
|
|
|
* meta_display_xwindow_is_a_no_focus_window:
|
|
|
|
* @display: A #MetaDisplay
|
|
|
|
* @xwindow: An X11 window
|
|
|
|
*
|
|
|
|
* Returns: %TRUE iff window is one of mutter's internal "no focus" windows
|
|
|
|
* (there is one per screen) which will have the focus when there is no
|
|
|
|
* actual client window focused.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
meta_display_xwindow_is_a_no_focus_window (MetaDisplay *display,
|
|
|
|
Window xwindow)
|
|
|
|
{
|
2013-10-03 22:31:09 +00:00
|
|
|
return xwindow == display->screen->no_focus_window;
|
2013-10-03 19:29:44 +00:00
|
|
|
}
|
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
static MetaCursor
|
|
|
|
meta_cursor_for_grab_op (MetaGrabOp op)
|
2013-10-03 19:29:44 +00:00
|
|
|
{
|
2014-03-20 19:29:30 +00:00
|
|
|
switch (op)
|
2001-07-26 03:14:45 +00:00
|
|
|
{
|
|
|
|
case META_GRAB_OP_RESIZING_SE:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_SE:
|
2013-11-19 00:34:04 +00:00
|
|
|
return META_CURSOR_SE_RESIZE;
|
2001-07-26 03:14:45 +00:00
|
|
|
break;
|
|
|
|
case META_GRAB_OP_RESIZING_S:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_S:
|
2013-11-19 00:34:04 +00:00
|
|
|
return META_CURSOR_SOUTH_RESIZE;
|
2001-07-26 03:14:45 +00:00
|
|
|
break;
|
|
|
|
case META_GRAB_OP_RESIZING_SW:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_SW:
|
2013-11-19 00:34:04 +00:00
|
|
|
return META_CURSOR_SW_RESIZE;
|
2001-07-26 03:14:45 +00:00
|
|
|
break;
|
|
|
|
case META_GRAB_OP_RESIZING_N:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_N:
|
2013-11-19 00:34:04 +00:00
|
|
|
return META_CURSOR_NORTH_RESIZE;
|
2001-07-26 03:14:45 +00:00
|
|
|
break;
|
|
|
|
case META_GRAB_OP_RESIZING_NE:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_NE:
|
2013-11-19 00:34:04 +00:00
|
|
|
return META_CURSOR_NE_RESIZE;
|
2001-07-26 03:14:45 +00:00
|
|
|
break;
|
|
|
|
case META_GRAB_OP_RESIZING_NW:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_NW:
|
2013-11-19 00:34:04 +00:00
|
|
|
return META_CURSOR_NW_RESIZE;
|
2001-07-26 03:14:45 +00:00
|
|
|
break;
|
|
|
|
case META_GRAB_OP_RESIZING_W:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_W:
|
2013-11-19 00:34:04 +00:00
|
|
|
return META_CURSOR_WEST_RESIZE;
|
2001-07-26 03:14:45 +00:00
|
|
|
break;
|
|
|
|
case META_GRAB_OP_RESIZING_E:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_E:
|
2013-11-19 00:34:04 +00:00
|
|
|
return META_CURSOR_EAST_RESIZE;
|
2001-07-26 03:14:45 +00:00
|
|
|
break;
|
2003-08-16 14:36:56 +00:00
|
|
|
case META_GRAB_OP_MOVING:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_MOVING:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
|
2013-11-19 00:34:04 +00:00
|
|
|
return META_CURSOR_MOVE_OR_RESIZE_WINDOW;
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
break;
|
2001-07-26 03:14:45 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-11-19 00:34:04 +00:00
|
|
|
return META_CURSOR_DEFAULT;
|
2001-07-26 03:14:45 +00:00
|
|
|
}
|
|
|
|
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
void
|
2014-05-14 13:16:20 +00:00
|
|
|
meta_display_update_cursor (MetaDisplay *display)
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
{
|
2014-05-14 13:16:20 +00:00
|
|
|
meta_screen_set_cursor (display->screen, meta_cursor_for_grab_op (display->grab_op));
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
}
|
|
|
|
|
2014-04-28 21:23:20 +00:00
|
|
|
static MetaWindow *
|
2014-06-11 20:36:17 +00:00
|
|
|
get_first_freefloating_window (MetaWindow *window)
|
2014-04-28 21:23:20 +00:00
|
|
|
{
|
2014-06-11 20:36:17 +00:00
|
|
|
while (meta_window_is_attached_dialog (window))
|
|
|
|
window = meta_window_get_transient_for (window);
|
|
|
|
|
|
|
|
/* Attached dialogs should always have a non-NULL transient-for */
|
|
|
|
g_assert (window != NULL);
|
|
|
|
|
|
|
|
return window;
|
2014-04-28 21:23:20 +00:00
|
|
|
}
|
|
|
|
|
2014-08-15 17:12:22 +00:00
|
|
|
static MetaEventRoute
|
|
|
|
get_event_route_from_grab_op (MetaGrabOp op)
|
|
|
|
{
|
2014-08-15 18:05:04 +00:00
|
|
|
switch (GRAB_OP_GET_BASE_TYPE (op))
|
2014-08-15 17:12:22 +00:00
|
|
|
{
|
|
|
|
case META_GRAB_OP_NONE:
|
|
|
|
/* begin_grab_op shouldn't be called with META_GRAB_OP_NONE. */
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
2014-08-15 18:05:04 +00:00
|
|
|
case META_GRAB_OP_WINDOW_BASE:
|
2014-08-15 17:12:22 +00:00
|
|
|
return META_EVENT_ROUTE_WINDOW_OP;
|
|
|
|
|
|
|
|
case META_GRAB_OP_COMPOSITOR:
|
|
|
|
/* begin_grab_op shouldn't be called with META_GRAB_OP_COMPOSITOR. */
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
|
|
|
case META_GRAB_OP_WAYLAND_POPUP:
|
|
|
|
return META_EVENT_ROUTE_WAYLAND_POPUP;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-11 06:22:00 +00:00
|
|
|
gboolean
|
|
|
|
meta_display_begin_grab_op (MetaDisplay *display,
|
2002-06-27 05:08:32 +00:00
|
|
|
MetaScreen *screen,
|
2001-07-11 06:22:00 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
MetaGrabOp op,
|
|
|
|
gboolean pointer_already_grabbed,
|
2006-10-13 00:28:34 +00:00
|
|
|
gboolean frame_action,
|
2001-07-11 06:22:00 +00:00
|
|
|
int button,
|
2014-04-07 21:22:55 +00:00
|
|
|
gulong modmask, /* XXX - ignored */
|
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-07-11 06:22:00 +00:00
|
|
|
int root_x,
|
|
|
|
int root_y)
|
|
|
|
{
|
2014-05-14 13:16:20 +00:00
|
|
|
MetaBackend *backend = meta_get_backend ();
|
2011-01-04 16:42:51 +00:00
|
|
|
MetaWindow *grab_window = NULL;
|
2014-08-15 17:12:22 +00:00
|
|
|
MetaEventRoute event_route;
|
2014-04-28 21:11:47 +00:00
|
|
|
|
2014-05-02 13:36:10 +00:00
|
|
|
g_assert (window != NULL);
|
|
|
|
|
2002-02-24 19:58:27 +00:00
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
2006-01-20 22:03:56 +00:00
|
|
|
"Doing grab op %u on window %s button %d pointer already grabbed: %d pointer pos %d,%d\n",
|
2014-05-02 13:36:10 +00:00
|
|
|
op, window->desc, button, pointer_already_grabbed,
|
2003-10-12 06:25:38 +00:00
|
|
|
root_x, root_y);
|
2014-04-24 14:42:18 +00:00
|
|
|
|
2001-07-11 06:22:00 +00:00
|
|
|
if (display->grab_op != META_GRAB_OP_NONE)
|
|
|
|
{
|
2014-05-02 13:36:10 +00:00
|
|
|
meta_warning ("Attempt to perform window operation %u on window %s when operation %u on %s already in effect\n",
|
|
|
|
op, window->desc, display->grab_op,
|
|
|
|
display->grab_window ? display->grab_window->desc : "none");
|
2001-07-11 06:22:00 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2001-07-26 03:14:45 +00:00
|
|
|
|
2014-08-15 17:12:22 +00:00
|
|
|
event_route = get_event_route_from_grab_op (op);
|
|
|
|
|
|
|
|
if (event_route == META_EVENT_ROUTE_WINDOW_OP)
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 19:35:03 +00:00
|
|
|
{
|
|
|
|
if (meta_prefs_get_raise_on_click ())
|
|
|
|
meta_window_raise (window);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
display->grab_initial_x = root_x;
|
|
|
|
display->grab_initial_y = root_y;
|
|
|
|
display->grab_threshold_movement_reached = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-28 21:23:20 +00:00
|
|
|
grab_window = window;
|
|
|
|
|
2014-06-11 20:36:17 +00:00
|
|
|
/* If we're trying to move a window, move the first
|
|
|
|
* non-attached dialog instead.
|
2011-01-04 16:42:51 +00:00
|
|
|
*/
|
2014-06-11 20:36:17 +00:00
|
|
|
if (meta_grab_op_is_moving (op))
|
|
|
|
grab_window = get_first_freefloating_window (window);
|
2011-01-04 16:42:51 +00:00
|
|
|
|
2014-04-28 21:12:39 +00:00
|
|
|
g_assert (grab_window != NULL);
|
|
|
|
g_assert (op != META_GRAB_OP_NONE);
|
|
|
|
|
2003-10-11 04:27:06 +00:00
|
|
|
display->grab_have_pointer = FALSE;
|
2014-04-23 14:38:30 +00:00
|
|
|
|
2001-07-11 06:22:00 +00:00
|
|
|
if (pointer_already_grabbed)
|
2001-07-26 03:14:45 +00:00
|
|
|
display->grab_have_pointer = TRUE;
|
2014-04-23 14:53:06 +00:00
|
|
|
|
2014-04-24 14:42:18 +00:00
|
|
|
/* Since grab operations often happen as a result of implicit
|
|
|
|
* pointer operations on the display X11 connection, we need
|
|
|
|
* to ungrab here to ensure that the backend's X11 can take
|
|
|
|
* the device grab. */
|
|
|
|
XIUngrabDevice (display->xdisplay,
|
|
|
|
META_VIRTUAL_CORE_POINTER_ID,
|
|
|
|
timestamp);
|
|
|
|
XSync (display->xdisplay, False);
|
|
|
|
|
2014-05-14 13:16:20 +00:00
|
|
|
if (meta_backend_grab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp))
|
|
|
|
display->grab_have_pointer = TRUE;
|
2001-07-11 06:22:00 +00:00
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
if (!display->grab_have_pointer && !meta_grab_op_is_keyboard (op))
|
2001-07-11 06:22:00 +00:00
|
|
|
{
|
2014-04-23 14:50:07 +00:00
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS, "XIGrabDevice() failed\n");
|
2001-07-11 06:22:00 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2001-08-19 18:09:10 +00:00
|
|
|
|
2014-08-15 17:12:22 +00:00
|
|
|
/* Grab keys when beginning window ops; see #126497 */
|
|
|
|
if (event_route == META_EVENT_ROUTE_WINDOW_OP)
|
2001-07-11 06:22:00 +00:00
|
|
|
{
|
2014-04-28 21:12:39 +00:00
|
|
|
display->grab_have_keyboard = meta_window_grab_all_keys (grab_window, timestamp);
|
2014-04-23 14:50:07 +00:00
|
|
|
|
2001-07-11 06:22:00 +00:00
|
|
|
if (!display->grab_have_keyboard)
|
|
|
|
{
|
2014-04-23 14:50:07 +00:00
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS, "grabbing all keys failed, ungrabbing pointer\n");
|
|
|
|
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID, 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
|
|
|
display->grab_have_pointer = FALSE;
|
2001-07-11 06:22:00 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
2014-04-28 21:11:47 +00:00
|
|
|
|
2014-08-15 17:12:22 +00:00
|
|
|
display->event_route = event_route;
|
2001-07-11 06:22:00 +00:00
|
|
|
display->grab_op = op;
|
2011-01-04 16:42:51 +00:00
|
|
|
display->grab_window = grab_window;
|
2001-07-11 06:22:00 +00:00
|
|
|
display->grab_button = button;
|
2014-04-28 21:17:53 +00:00
|
|
|
display->grab_tile_mode = grab_window->tile_mode;
|
|
|
|
display->grab_tile_monitor_number = grab_window->tile_monitor_number;
|
2003-10-12 06:25:38 +00:00
|
|
|
display->grab_anchor_root_x = root_x;
|
|
|
|
display->grab_anchor_root_y = root_y;
|
2002-12-10 03:23:04 +00:00
|
|
|
display->grab_latest_motion_x = root_x;
|
|
|
|
display->grab_latest_motion_y = root_y;
|
2002-08-10 05:27:17 +00:00
|
|
|
display->grab_last_moveresize_time.tv_sec = 0;
|
|
|
|
display->grab_last_moveresize_time.tv_usec = 0;
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
display->grab_last_user_action_was_snap = FALSE;
|
2006-10-13 00:28:34 +00:00
|
|
|
display->grab_frame_action = frame_action;
|
2010-09-18 20:28:30 +00:00
|
|
|
display->grab_resize_unmaximize = 0;
|
2006-10-13 00:28:34 +00:00
|
|
|
|
2014-05-14 13:16:20 +00:00
|
|
|
meta_display_update_cursor (display);
|
|
|
|
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-19 00:45:24 +00:00
|
|
|
if (display->grab_resize_timeout_id)
|
|
|
|
{
|
|
|
|
g_source_remove (display->grab_resize_timeout_id);
|
|
|
|
display->grab_resize_timeout_id = 0;
|
|
|
|
}
|
2014-04-28 21:11:47 +00:00
|
|
|
|
2002-02-24 19:58:27 +00:00
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
2006-01-20 22:03:56 +00:00
|
|
|
"Grab op %u on window %s successful\n",
|
2002-06-27 05:08:32 +00:00
|
|
|
display->grab_op, window ? window->desc : "(null)");
|
2001-07-11 06:22:00 +00:00
|
|
|
|
2014-05-20 21:47:10 +00:00
|
|
|
meta_window_get_frame_rect (display->grab_window,
|
|
|
|
&display->grab_initial_window_pos);
|
|
|
|
display->grab_anchor_window_pos = display->grab_initial_window_pos;
|
2014-04-28 21:12:39 +00:00
|
|
|
|
2014-03-11 17:45:39 +00:00
|
|
|
if (meta_is_wayland_compositor ())
|
2014-07-22 00:07:19 +00:00
|
|
|
{
|
|
|
|
meta_display_sync_wayland_input_focus (display);
|
|
|
|
meta_display_cancel_touch (display);
|
|
|
|
}
|
2014-03-11 17:45:39 +00:00
|
|
|
|
2012-02-10 15:27:14 +00:00
|
|
|
g_signal_emit (display, display_signals[GRAB_OP_BEGIN], 0,
|
|
|
|
screen, display->grab_window, display->grab_op);
|
2014-04-28 21:11:47 +00:00
|
|
|
|
2014-08-15 17:12:22 +00:00
|
|
|
if (display->event_route == META_EVENT_ROUTE_WINDOW_OP)
|
|
|
|
meta_window_grab_op_began (display->grab_window, display->grab_op);
|
2014-04-29 19:30:21 +00:00
|
|
|
|
2001-07-11 06:22:00 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_end_grab_op (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-07-11 06:22:00 +00:00
|
|
|
{
|
2014-07-17 19:51:42 +00:00
|
|
|
MetaWindow *grab_window = display->grab_window;
|
|
|
|
MetaGrabOp grab_op = display->grab_op;
|
|
|
|
|
2003-01-21 22:40:25 +00:00
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
2014-07-17 19:51:42 +00:00
|
|
|
"Ending grab op %u at time %u\n", grab_op, timestamp);
|
2014-04-22 15:27:52 +00:00
|
|
|
|
2014-08-15 17:12:22 +00:00
|
|
|
if (display->event_route == META_EVENT_ROUTE_NORMAL)
|
2001-07-11 06:22:00 +00:00
|
|
|
return;
|
2001-08-19 18:09:10 +00:00
|
|
|
|
2012-02-10 15:27:14 +00:00
|
|
|
g_signal_emit (display, display_signals[GRAB_OP_END], 0,
|
2014-07-17 19:51:42 +00:00
|
|
|
display->screen, grab_window, grab_op);
|
2014-04-29 19:30:21 +00:00
|
|
|
|
2014-08-15 17:12:22 +00:00
|
|
|
if (display->event_route == META_EVENT_ROUTE_WINDOW_OP)
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 19:35:03 +00:00
|
|
|
{
|
2014-04-20 17:04:32 +00:00
|
|
|
/* Clear out the edge cache */
|
|
|
|
meta_display_cleanup_edges (display);
|
|
|
|
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 19:35:03 +00:00
|
|
|
/* Only raise the window in orthogonal raise
|
|
|
|
* ('do-not-raise-on-click') mode if the user didn't try to move
|
|
|
|
* or resize the given window by at least a threshold amount.
|
|
|
|
* For raise on click mode, the window was raised at the
|
|
|
|
* beginning of the grab_op.
|
|
|
|
*/
|
2014-04-20 17:04:32 +00:00
|
|
|
if (!meta_prefs_get_raise_on_click () &&
|
|
|
|
display->grab_threshold_movement_reached)
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 19:35:03 +00:00
|
|
|
meta_window_raise (display->grab_window);
|
2014-08-15 17:12:22 +00:00
|
|
|
|
|
|
|
meta_window_grab_op_ended (grab_window, grab_op);
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 19:35:03 +00:00
|
|
|
}
|
2014-04-20 17:00:33 +00:00
|
|
|
|
2001-07-11 06:22:00 +00:00
|
|
|
if (display->grab_have_pointer)
|
2002-03-02 15:26:07 +00:00
|
|
|
{
|
2014-04-23 14:50:07 +00:00
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp);
|
2002-03-02 15:26:07 +00:00
|
|
|
}
|
2001-07-11 06:22:00 +00:00
|
|
|
|
|
|
|
if (display->grab_have_keyboard)
|
2002-03-02 15:26:07 +00:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
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
|
|
|
"Ungrabbing all keys timestamp %u\n", timestamp);
|
2014-07-17 19:51:42 +00:00
|
|
|
meta_window_ungrab_all_keys (grab_window, timestamp);
|
2002-03-02 15:26:07 +00:00
|
|
|
}
|
2002-12-10 03:23:04 +00:00
|
|
|
|
2014-08-15 17:12:22 +00:00
|
|
|
display->event_route = META_EVENT_ROUTE_NORMAL;
|
|
|
|
display->grab_op = META_GRAB_OP_NONE;
|
2001-07-11 06:22:00 +00:00
|
|
|
display->grab_window = NULL;
|
2011-01-19 16:00:18 +00:00
|
|
|
display->grab_tile_mode = META_TILE_NONE;
|
2011-10-08 15:00:16 +00:00
|
|
|
display->grab_tile_monitor_number = -1;
|
2002-03-17 17:22:23 +00:00
|
|
|
|
2014-05-14 13:16:20 +00:00
|
|
|
meta_display_update_cursor (display);
|
|
|
|
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-19 00:45:24 +00:00
|
|
|
if (display->grab_resize_timeout_id)
|
|
|
|
{
|
|
|
|
g_source_remove (display->grab_resize_timeout_id);
|
|
|
|
display->grab_resize_timeout_id = 0;
|
|
|
|
}
|
2014-03-11 17:45:39 +00:00
|
|
|
|
|
|
|
if (meta_is_wayland_compositor ())
|
|
|
|
meta_display_sync_wayland_input_focus (display);
|
2001-07-26 03:14:45 +00:00
|
|
|
}
|
|
|
|
|
2009-08-28 15:25:51 +00:00
|
|
|
/**
|
|
|
|
* meta_display_get_grab_op:
|
2013-02-15 18:42:08 +00:00
|
|
|
* @display: The #MetaDisplay that the window is on
|
|
|
|
|
2009-08-28 15:25:51 +00:00
|
|
|
* Gets the current grab operation, if any.
|
|
|
|
*
|
|
|
|
* Return value: the current grab operation, or %META_GRAB_OP_NONE if
|
|
|
|
* Mutter doesn't currently have a grab. %META_GRAB_OP_COMPOSITOR will
|
|
|
|
* be returned if a compositor-plugin modal operation is in effect
|
|
|
|
* (See mutter_begin_modal_for_plugin())
|
|
|
|
*/
|
|
|
|
MetaGrabOp
|
|
|
|
meta_display_get_grab_op (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
return display->grab_op;
|
|
|
|
}
|
|
|
|
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 19:35:03 +00:00
|
|
|
void
|
|
|
|
meta_display_check_threshold_reached (MetaDisplay *display,
|
|
|
|
int x,
|
|
|
|
int y)
|
|
|
|
{
|
|
|
|
/* Don't bother doing the check again if we've already reached the threshold */
|
2006-01-24 01:07:41 +00:00
|
|
|
if (meta_prefs_get_raise_on_click () ||
|
|
|
|
display->grab_threshold_movement_reached)
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 19:35:03 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (ABS (display->grab_initial_x - x) >= 8 ||
|
|
|
|
ABS (display->grab_initial_y - y) >= 8)
|
|
|
|
display->grab_threshold_movement_reached = TRUE;
|
|
|
|
}
|
|
|
|
|
2001-08-30 04:01:38 +00:00
|
|
|
void
|
|
|
|
meta_display_increment_event_serial (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
/* We just make some random X request */
|
|
|
|
XDeleteProperty (display->xdisplay, display->leader_window,
|
2008-05-02 18:49:01 +00:00
|
|
|
display->atom__MOTIF_WM_HINTS);
|
2001-08-30 04:01:38 +00:00
|
|
|
}
|
2001-10-07 23:06:19 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_update_active_window_hint (MetaDisplay *display)
|
|
|
|
{
|
2007-04-03 22:26:47 +00:00
|
|
|
gulong data[1];
|
2001-10-07 23:06:19 +00:00
|
|
|
|
|
|
|
if (display->focus_window)
|
|
|
|
data[0] = display->focus_window->xwindow;
|
|
|
|
else
|
|
|
|
data[0] = None;
|
2007-04-03 22:26:47 +00:00
|
|
|
|
2013-10-03 22:31:09 +00:00
|
|
|
meta_error_trap_push (display);
|
|
|
|
XChangeProperty (display->xdisplay, display->screen->xroot,
|
|
|
|
display->atom__NET_ACTIVE_WINDOW,
|
|
|
|
XA_WINDOW,
|
|
|
|
32, PropModeReplace, (guchar*) data, 1);
|
|
|
|
meta_error_trap_pop (display);
|
2001-10-07 23:06:19 +00:00
|
|
|
}
|
2001-10-15 03:39:41 +00:00
|
|
|
|
2002-02-07 03:25:34 +00:00
|
|
|
void
|
|
|
|
meta_display_queue_retheme_all_windows (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
GSList* windows;
|
|
|
|
GSList *tmp;
|
|
|
|
|
2009-06-15 19:32:23 +00:00
|
|
|
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
|
2002-02-07 03:25:34 +00:00
|
|
|
tmp = windows;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-11 01:15:33 +00:00
|
|
|
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
|
2013-11-15 22:37:50 +00:00
|
|
|
meta_window_frame_size_changed (window);
|
2002-02-07 03:25:34 +00:00
|
|
|
if (window->frame)
|
2002-05-31 00:02:54 +00:00
|
|
|
{
|
|
|
|
meta_frame_queue_draw (window->frame);
|
2003-01-05 07:51:02 +00:00
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:25:34 +00:00
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (windows);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_retheme_all (void)
|
|
|
|
{
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-25 03:39:13 +00:00
|
|
|
meta_display_queue_retheme_all_windows (meta_get_display ());
|
2002-02-07 03:25:34 +00:00
|
|
|
}
|
|
|
|
|
2014-04-24 14:48:47 +00:00
|
|
|
static void
|
|
|
|
set_cursor_theme (Display *xdisplay)
|
2005-07-11 13:25:08 +00:00
|
|
|
{
|
2014-04-24 14:48:47 +00:00
|
|
|
XcursorSetTheme (xdisplay, meta_prefs_get_cursor_theme ());
|
|
|
|
XcursorSetDefaultSize (xdisplay, meta_prefs_get_cursor_size ());
|
|
|
|
}
|
2005-07-11 13:25:08 +00:00
|
|
|
|
2014-04-24 14:48:47 +00:00
|
|
|
static void
|
|
|
|
update_cursor_theme (void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MetaDisplay *display = meta_get_display ();
|
|
|
|
set_cursor_theme (display->xdisplay);
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-25 03:39:13 +00:00
|
|
|
|
2014-04-24 14:48:47 +00:00
|
|
|
if (display->screen)
|
|
|
|
meta_screen_update_cursor (display->screen);
|
|
|
|
}
|
2014-04-24 14:51:13 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
if (META_IS_BACKEND_X11 (backend))
|
|
|
|
{
|
|
|
|
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
|
|
|
set_cursor_theme (xdisplay);
|
|
|
|
}
|
|
|
|
}
|
2005-07-11 13:25:08 +00:00
|
|
|
}
|
|
|
|
|
2011-11-02 15:34:45 +00:00
|
|
|
/*
|
2008-01-13 01:01:21 +00:00
|
|
|
* Stores whether syncing is currently enabled.
|
2008-01-06 21:23:33 +00:00
|
|
|
*/
|
2002-01-28 02:09:12 +00:00
|
|
|
static gboolean is_syncing = FALSE;
|
|
|
|
|
2008-01-13 01:01:21 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* meta_is_syncing:
|
2008-01-06 21:23:33 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Returns whether X synchronisation is currently enabled.
|
2008-01-06 21:23:33 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* FIXME: This is *only* called by meta_display_open(), but by that time
|
2008-01-06 21:23:33 +00:00
|
|
|
* we have already turned syncing on or off on startup, and we don't
|
Comprehensively rename to Mutter
Code:
All references in the code not related to themes, keybindings, or
GConf were changed from 'metacity' to 'mutter'. This includes, among other
things, strings, comments, the atoms used in the message protocol, and
the envvars used for debugging. The GConf schema file was reduced to
the 3 settings new to mutter.
The overall version was brought up to 2.27 to match current gnome.
Structure:
All files named '*metacity*' were renamed '*mutter*' with appropriate
changes in the automake system. Files removed are
doc/creating_themes, src/themes, doc/metacity-theme.dtd,
metacity.doap. These files will eventually end up in an external
gnome-wm-data module.
Installation location:
On the filesystem the mutter-plugindir was change from
$(libdir)/metacity/plugins/clutter to just $(libdir)/mutter/plugins.
The mutter-plugins.pc.in reflects these changes.
Note:
mutter.desktop.in and mutter-wm.desktop both continue to have
X-GNOME-WMSettingsModule=metacity set. This allows
gnome-control-center to continue using libmetacity.so for
configuration. This is fine since most the general keybindings and wm
settings are being read from /apps/metacity/* in gconf.
2009-06-10 10:29:20 +00:00
|
|
|
* have any way to do so while Mutter is running, so it's rather
|
2008-01-06 21:23:33 +00:00
|
|
|
* pointless.
|
2011-11-02 15:34:45 +00:00
|
|
|
*
|
|
|
|
* Returns: %TRUE if we must wait for events whenever we send X requests;
|
|
|
|
* %FALSE otherwise.
|
2008-01-06 21:23:33 +00:00
|
|
|
*/
|
2002-01-28 02:09:12 +00:00
|
|
|
gboolean
|
|
|
|
meta_is_syncing (void)
|
|
|
|
{
|
|
|
|
return is_syncing;
|
|
|
|
}
|
|
|
|
|
2008-01-13 01:01:21 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* meta_set_syncing:
|
2013-02-15 18:42:08 +00:00
|
|
|
* @setting: whether to turn syncing on or off
|
2008-01-06 21:23:33 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* A handy way to turn on synchronisation on or off for every display.
|
2008-01-06 21:23:33 +00:00
|
|
|
*/
|
2002-01-28 02:09:12 +00:00
|
|
|
void
|
|
|
|
meta_set_syncing (gboolean setting)
|
|
|
|
{
|
|
|
|
if (setting != is_syncing)
|
|
|
|
{
|
|
|
|
is_syncing = setting;
|
2010-05-25 17:24:42 +00:00
|
|
|
if (meta_get_display ())
|
|
|
|
XSynchronize (meta_get_display ()->xdisplay, is_syncing);
|
2002-01-28 02:09:12 +00:00
|
|
|
}
|
|
|
|
}
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-27 02:05:39 +00:00
|
|
|
|
2014-02-15 16:33:12 +00:00
|
|
|
/*
|
|
|
|
* How long, in milliseconds, we should wait after pinging a window
|
|
|
|
* before deciding it's not going to get back to us.
|
|
|
|
*/
|
|
|
|
#define PING_TIMEOUT_DELAY 5000
|
|
|
|
|
|
|
|
/**
|
|
|
|
* meta_display_ping_timeout:
|
|
|
|
* @data: All the information about this ping. It is a #MetaPingData
|
|
|
|
* cast to a #gpointer in order to be passable to a timeout function.
|
|
|
|
* This function will also free this parameter.
|
|
|
|
*
|
|
|
|
* Does whatever it is we decided to do when a window didn't respond
|
|
|
|
* to a ping. We also remove the ping from the display's list of
|
|
|
|
* pending pings. This function is called by the event loop when the timeout
|
|
|
|
* times out which we created at the start of the ping.
|
|
|
|
*
|
|
|
|
* Returns: Always returns %FALSE, because this function is called as a
|
|
|
|
* timeout and we don't want to run the timer again.
|
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
meta_display_ping_timeout (gpointer data)
|
|
|
|
{
|
|
|
|
MetaPingData *ping_data = data;
|
2014-05-20 18:48:08 +00:00
|
|
|
MetaWindow *window = ping_data->window;
|
|
|
|
MetaDisplay *display = window->display;
|
|
|
|
|
|
|
|
meta_window_set_alive (window, FALSE);
|
2014-02-15 16:33:12 +00:00
|
|
|
|
|
|
|
ping_data->ping_timeout_id = 0;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_PING,
|
|
|
|
"Ping %u on window %s timed out\n",
|
2014-05-20 18:48:08 +00:00
|
|
|
ping_data->serial, ping_data->window->desc);
|
2014-02-15 16:33:12 +00:00
|
|
|
|
|
|
|
display->pending_pings = g_slist_remove (display->pending_pings, ping_data);
|
|
|
|
ping_data_free (ping_data);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* meta_display_ping_window:
|
|
|
|
* @display: The #MetaDisplay that the window is on
|
|
|
|
* @window: The #MetaWindow to send the ping to
|
|
|
|
* @timestamp: The timestamp of the ping. Used for uniqueness.
|
|
|
|
* Cannot be CurrentTime; use a real timestamp!
|
|
|
|
*
|
|
|
|
* Sends a ping request to a window. The window must respond to
|
|
|
|
* the request within a certain amount of time. If it does, we
|
|
|
|
* will call one callback; if the time passes and we haven't had
|
|
|
|
* a response, we call a different callback. The window must have
|
|
|
|
* the hint showing that it can respond to a ping; if it doesn't,
|
|
|
|
* we call the "got a response" callback immediately and return.
|
|
|
|
* This function returns straight away after setting things up;
|
|
|
|
* the callbacks will be called from the event loop.
|
|
|
|
*/
|
|
|
|
void
|
2014-05-20 18:48:08 +00:00
|
|
|
meta_display_ping_window (MetaWindow *window,
|
|
|
|
guint32 serial)
|
2014-02-15 16:33:12 +00:00
|
|
|
{
|
|
|
|
MetaDisplay *display = window->display;
|
|
|
|
MetaPingData *ping_data;
|
|
|
|
|
2014-05-20 18:48:08 +00:00
|
|
|
if (serial == 0)
|
2014-02-15 16:33:12 +00:00
|
|
|
{
|
2014-05-20 18:48:08 +00:00
|
|
|
meta_warning ("Tried to ping a window with a bad serial! Not allowed.\n");
|
2014-02-15 16:33:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-02-19 01:28:23 +00:00
|
|
|
if (!window->can_ping)
|
2014-05-20 18:48:08 +00:00
|
|
|
return;
|
2014-02-15 16:33:12 +00:00
|
|
|
|
|
|
|
ping_data = g_new (MetaPingData, 1);
|
|
|
|
ping_data->window = window;
|
2014-05-20 18:48:08 +00:00
|
|
|
ping_data->serial = serial;
|
2014-02-15 16:33:12 +00:00
|
|
|
ping_data->ping_timeout_id = g_timeout_add (PING_TIMEOUT_DELAY,
|
|
|
|
meta_display_ping_timeout,
|
|
|
|
ping_data);
|
2014-04-10 16:58:58 +00:00
|
|
|
g_source_set_name_by_id (ping_data->ping_timeout_id, "[mutter] meta_display_ping_timeout");
|
2014-02-15 16:33:12 +00:00
|
|
|
|
|
|
|
display->pending_pings = g_slist_prepend (display->pending_pings, ping_data);
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_PING,
|
2014-05-20 18:48:08 +00:00
|
|
|
"Sending ping with serial %u to window %s\n",
|
|
|
|
serial, window->desc);
|
2014-02-15 16:33:12 +00:00
|
|
|
|
2014-05-20 18:48:08 +00:00
|
|
|
META_WINDOW_GET_CLASS (window)->ping (window, serial);
|
2014-02-15 16:33:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* meta_display_pong_for_serial:
|
|
|
|
* @display: the display we got the pong from
|
|
|
|
* @serial: the serial in the pong repsonse
|
|
|
|
*
|
|
|
|
* Process the pong (the response message) from the ping we sent
|
|
|
|
* to the window. This involves removing the timeout, calling the
|
|
|
|
* reply handler function, and freeing memory.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
meta_display_pong_for_serial (MetaDisplay *display,
|
|
|
|
guint32 serial)
|
|
|
|
{
|
|
|
|
GSList *tmp;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_PING, "Received a pong with serial %u\n", serial);
|
|
|
|
|
|
|
|
for (tmp = display->pending_pings; tmp; tmp = tmp->next)
|
|
|
|
{
|
|
|
|
MetaPingData *ping_data = tmp->data;
|
|
|
|
|
2014-05-20 18:48:08 +00:00
|
|
|
if (serial == ping_data->serial)
|
2014-02-15 16:33:12 +00:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_PING,
|
|
|
|
"Matching ping found for pong %u\n",
|
2014-05-20 18:48:08 +00:00
|
|
|
ping_data->serial);
|
2014-02-15 16:33:12 +00:00
|
|
|
|
|
|
|
/* Remove the ping data from the list */
|
|
|
|
display->pending_pings = g_slist_remove (display->pending_pings,
|
|
|
|
ping_data);
|
|
|
|
|
|
|
|
/* Remove the timeout */
|
|
|
|
if (ping_data->ping_timeout_id != 0)
|
|
|
|
{
|
|
|
|
g_source_remove (ping_data->ping_timeout_id);
|
|
|
|
ping_data->ping_timeout_id = 0;
|
|
|
|
}
|
|
|
|
|
2014-05-20 18:48:08 +00:00
|
|
|
meta_window_set_alive (ping_data->window, TRUE);
|
2014-02-15 16:33:12 +00:00
|
|
|
ping_data_free (ping_data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-19 00:57:32 +00:00
|
|
|
static MetaGroup *
|
|
|
|
get_focused_group (MetaDisplay *display)
|
2006-04-15 02:05:44 +00:00
|
|
|
{
|
|
|
|
if (display->focus_window)
|
|
|
|
return display->focus_window->group;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define IN_TAB_CHAIN(w,t) (((t) == META_TAB_LIST_NORMAL && META_WINDOW_IN_NORMAL_TAB_CHAIN (w)) \
|
|
|
|
|| ((t) == META_TAB_LIST_DOCKS && META_WINDOW_IN_DOCK_TAB_CHAIN (w)) \
|
2014-03-19 00:57:32 +00:00
|
|
|
|| ((t) == META_TAB_LIST_GROUP && META_WINDOW_IN_GROUP_TAB_CHAIN (w, get_focused_group (w->display))) \
|
2012-03-12 22:00:12 +00:00
|
|
|
|| ((t) == META_TAB_LIST_NORMAL_ALL && META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE (w)))
|
2002-04-05 15:52:49 +00:00
|
|
|
|
2002-03-12 04:34:17 +00:00
|
|
|
static MetaWindow*
|
|
|
|
find_tab_forward (MetaDisplay *display,
|
2002-04-05 15:52:49 +00:00
|
|
|
MetaTabList type,
|
2002-03-12 04:34:17 +00:00
|
|
|
MetaWorkspace *workspace,
|
2004-10-25 16:17:19 +00:00
|
|
|
GList *start,
|
|
|
|
gboolean skip_first)
|
2002-03-12 04:34:17 +00:00
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
g_return_val_if_fail (start != NULL, NULL);
|
2003-08-15 22:09:55 +00:00
|
|
|
g_return_val_if_fail (workspace != NULL, NULL);
|
2002-05-11 06:59:54 +00:00
|
|
|
|
2004-10-25 16:17:19 +00:00
|
|
|
tmp = start;
|
|
|
|
if (skip_first)
|
|
|
|
tmp = tmp->next;
|
|
|
|
|
2002-03-12 04:34:17 +00:00
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
|
|
|
|
2013-10-03 22:31:09 +00:00
|
|
|
if (IN_TAB_CHAIN (window, type))
|
2002-03-12 04:34:17 +00:00
|
|
|
return window;
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
2003-08-15 22:09:55 +00:00
|
|
|
tmp = workspace->mru_list;
|
2002-03-12 04:34:17 +00:00
|
|
|
while (tmp != start)
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
|
|
|
|
2003-08-15 22:09:55 +00:00
|
|
|
if (IN_TAB_CHAIN (window, type))
|
2002-03-12 04:34:17 +00:00
|
|
|
return window;
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
2014-05-02 13:34:02 +00:00
|
|
|
}
|
2002-03-12 04:34:17 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static MetaWindow*
|
|
|
|
find_tab_backward (MetaDisplay *display,
|
2002-04-05 15:52:49 +00:00
|
|
|
MetaTabList type,
|
2002-03-12 04:34:17 +00:00
|
|
|
MetaWorkspace *workspace,
|
2004-10-25 16:17:19 +00:00
|
|
|
GList *start,
|
|
|
|
gboolean skip_last)
|
2002-03-12 04:34:17 +00:00
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
g_return_val_if_fail (start != NULL, NULL);
|
2003-08-15 22:09:55 +00:00
|
|
|
g_return_val_if_fail (workspace != NULL, NULL);
|
2004-10-25 16:17:19 +00:00
|
|
|
|
|
|
|
tmp = start;
|
2014-05-02 13:34:02 +00:00
|
|
|
if (skip_last)
|
2004-10-25 16:17:19 +00:00
|
|
|
tmp = tmp->prev;
|
2002-03-12 04:34:17 +00:00
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
|
|
|
|
2013-10-03 22:31:09 +00:00
|
|
|
if (IN_TAB_CHAIN (window, type))
|
2002-03-12 04:34:17 +00:00
|
|
|
return window;
|
|
|
|
|
|
|
|
tmp = tmp->prev;
|
|
|
|
}
|
|
|
|
|
2003-08-15 22:09:55 +00:00
|
|
|
tmp = g_list_last (workspace->mru_list);
|
2002-03-12 04:34:17 +00:00
|
|
|
while (tmp != start)
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
|
|
|
|
2003-08-15 22:09:55 +00:00
|
|
|
if (IN_TAB_CHAIN (window, type))
|
2002-03-12 04:34:17 +00:00
|
|
|
return window;
|
|
|
|
|
|
|
|
tmp = tmp->prev;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-12-03 16:59:11 +00:00
|
|
|
static int
|
|
|
|
mru_cmp (gconstpointer a,
|
|
|
|
gconstpointer b)
|
|
|
|
{
|
|
|
|
guint32 time_a, time_b;
|
|
|
|
|
|
|
|
time_a = meta_window_get_user_time ((MetaWindow *)a);
|
|
|
|
time_b = meta_window_get_user_time ((MetaWindow *)b);
|
|
|
|
|
|
|
|
if (time_a > time_b)
|
|
|
|
return -1;
|
|
|
|
else if (time_a < time_b)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_display_get_tab_list:
|
|
|
|
* @display: a #MetaDisplay
|
|
|
|
* @type: type of tab list
|
2014-05-28 19:44:23 +00:00
|
|
|
* @workspace: (nullable): origin workspace
|
2010-09-01 19:39:53 +00:00
|
|
|
*
|
|
|
|
* Determine the list of windows that should be displayed for Alt-TAB
|
|
|
|
* functionality. The windows are returned in most recently used order.
|
2012-12-03 16:59:11 +00:00
|
|
|
* If @workspace is not %NULL, the list only conains windows that are on
|
|
|
|
* @workspace or have the demands-attention hint set; otherwise it contains
|
2014-06-03 12:40:15 +00:00
|
|
|
* all windows.
|
2010-09-01 19:39:53 +00:00
|
|
|
*
|
|
|
|
* Returns: (transfer container) (element-type Meta.Window): List of windows
|
|
|
|
*/
|
2003-03-15 02:16:21 +00:00
|
|
|
GList*
|
2002-03-12 04:34:17 +00:00
|
|
|
meta_display_get_tab_list (MetaDisplay *display,
|
2002-04-05 15:52:49 +00:00
|
|
|
MetaTabList type,
|
2002-03-12 04:34:17 +00:00
|
|
|
MetaWorkspace *workspace)
|
|
|
|
{
|
2012-12-03 23:05:22 +00:00
|
|
|
GList *tab_list = NULL;
|
2012-12-03 16:59:11 +00:00
|
|
|
GList *global_mru_list = NULL;
|
|
|
|
GList *mru_list, *tmp;
|
2012-12-03 23:05:22 +00:00
|
|
|
GSList *windows = meta_display_list_windows (display, META_LIST_DEFAULT);
|
|
|
|
GSList *w;
|
2002-03-12 04:34:17 +00:00
|
|
|
|
2012-12-03 16:59:11 +00:00
|
|
|
if (workspace == NULL)
|
|
|
|
{
|
|
|
|
/* Yay for mixing GList and GSList in the API */
|
|
|
|
for (w = windows; w; w = w->next)
|
|
|
|
global_mru_list = g_list_prepend (global_mru_list, w->data);
|
|
|
|
global_mru_list = g_list_sort (global_mru_list, mru_cmp);
|
|
|
|
}
|
|
|
|
|
|
|
|
mru_list = workspace ? workspace->mru_list : global_mru_list;
|
2002-04-05 15:52:49 +00:00
|
|
|
|
2013-02-17 20:27:21 +00:00
|
|
|
/* Windows sellout mode - MRU order.
|
2002-10-24 05:15:28 +00:00
|
|
|
*/
|
2012-12-03 16:59:11 +00:00
|
|
|
for (tmp = mru_list; tmp; tmp = tmp->next)
|
2012-12-03 23:05:22 +00:00
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
2002-10-24 05:15:28 +00:00
|
|
|
|
2013-10-03 22:31:09 +00:00
|
|
|
if (IN_TAB_CHAIN (window, type))
|
2012-12-03 23:05:22 +00:00
|
|
|
tab_list = g_list_prepend (tab_list, window);
|
|
|
|
}
|
2008-02-02 04:05:16 +00:00
|
|
|
|
2012-12-03 23:05:22 +00:00
|
|
|
tab_list = g_list_reverse (tab_list);
|
2008-02-02 04:05:16 +00:00
|
|
|
|
2012-12-03 16:59:11 +00:00
|
|
|
/* If filtering by workspace, include windows from
|
|
|
|
* other workspaces that demand attention
|
|
|
|
*/
|
|
|
|
if (workspace)
|
|
|
|
for (w = windows; w; w = w->next)
|
|
|
|
{
|
|
|
|
MetaWindow *l_window = w->data;
|
2008-02-02 04:05:16 +00:00
|
|
|
|
2012-12-03 16:59:11 +00:00
|
|
|
if (l_window->wm_state_demands_attention &&
|
|
|
|
l_window->workspace != workspace &&
|
|
|
|
IN_TAB_CHAIN (l_window, type))
|
2012-12-03 23:05:22 +00:00
|
|
|
tab_list = g_list_prepend (tab_list, l_window);
|
2012-12-03 16:59:11 +00:00
|
|
|
}
|
2012-03-23 08:45:50 +00:00
|
|
|
|
2012-12-03 16:59:11 +00:00
|
|
|
g_list_free (global_mru_list);
|
2012-12-03 23:05:22 +00:00
|
|
|
g_slist_free (windows);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-03-12 04:34:17 +00:00
|
|
|
return tab_list;
|
|
|
|
}
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_display_get_tab_next:
|
|
|
|
* @display: a #MetaDisplay
|
|
|
|
* @type: type of tab list
|
|
|
|
* @workspace: origin workspace
|
2014-05-28 19:44:23 +00:00
|
|
|
* @window: (nullable): starting window
|
2014-05-02 13:34:02 +00:00
|
|
|
* @backward: If %TRUE, look for the previous window.
|
2010-09-01 19:39:53 +00:00
|
|
|
*
|
|
|
|
* Determine the next window that should be displayed for Alt-TAB
|
|
|
|
* functionality.
|
|
|
|
*
|
|
|
|
* Returns: (transfer none): Next window
|
|
|
|
*
|
|
|
|
*/
|
2002-03-12 04:34:17 +00:00
|
|
|
MetaWindow*
|
|
|
|
meta_display_get_tab_next (MetaDisplay *display,
|
2002-04-05 15:52:49 +00:00
|
|
|
MetaTabList type,
|
2002-03-12 04:34:17 +00:00
|
|
|
MetaWorkspace *workspace,
|
|
|
|
MetaWindow *window,
|
|
|
|
gboolean backward)
|
|
|
|
{
|
2004-10-25 16:17:19 +00:00
|
|
|
gboolean skip;
|
2003-03-15 02:16:21 +00:00
|
|
|
GList *tab_list;
|
2006-01-20 22:03:56 +00:00
|
|
|
MetaWindow *ret;
|
2014-06-03 12:40:15 +00:00
|
|
|
tab_list = meta_display_get_tab_list (display, type, workspace);
|
2003-03-15 02:16:21 +00:00
|
|
|
|
|
|
|
if (tab_list == NULL)
|
2002-03-12 04:34:17 +00:00
|
|
|
return NULL;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-03-12 04:34:17 +00:00
|
|
|
if (window != NULL)
|
|
|
|
{
|
|
|
|
g_assert (window->display == display);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-03-12 04:34:17 +00:00
|
|
|
if (backward)
|
2013-10-03 22:31:09 +00:00
|
|
|
ret = find_tab_backward (display, type, workspace, g_list_find (tab_list, window), TRUE);
|
2006-01-20 22:03:56 +00:00
|
|
|
else
|
2013-10-03 22:31:09 +00:00
|
|
|
ret = find_tab_forward (display, type, workspace, g_list_find (tab_list, window), TRUE);
|
2002-03-12 04:34:17 +00:00
|
|
|
}
|
|
|
|
else
|
2006-01-20 22:03:56 +00:00
|
|
|
{
|
2014-05-02 13:34:02 +00:00
|
|
|
skip = display->focus_window != NULL &&
|
2009-02-07 23:05:42 +00:00
|
|
|
tab_list->data == display->focus_window;
|
2006-01-20 22:03:56 +00:00
|
|
|
if (backward)
|
2013-10-03 22:31:09 +00:00
|
|
|
ret = find_tab_backward (display, type, workspace, tab_list, skip);
|
2006-01-20 22:03:56 +00:00
|
|
|
else
|
2013-10-03 22:31:09 +00:00
|
|
|
ret = find_tab_forward (display, type, workspace, tab_list, skip);
|
2006-01-20 22:03:56 +00:00
|
|
|
}
|
2003-03-15 02:16:21 +00:00
|
|
|
|
|
|
|
g_list_free (tab_list);
|
2006-01-20 22:03:56 +00:00
|
|
|
return ret;
|
2002-03-12 04:34:17 +00:00
|
|
|
}
|
2002-03-17 17:22:23 +00:00
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_display_get_tab_current:
|
|
|
|
* @display: a #MetaDisplay
|
|
|
|
* @type: type of tab list
|
|
|
|
* @workspace: origin workspace
|
|
|
|
*
|
|
|
|
* Determine the active window that should be displayed for Alt-TAB.
|
|
|
|
*
|
|
|
|
* Returns: (transfer none): Current window
|
|
|
|
*
|
|
|
|
*/
|
2002-09-04 04:15:46 +00:00
|
|
|
MetaWindow*
|
|
|
|
meta_display_get_tab_current (MetaDisplay *display,
|
|
|
|
MetaTabList type,
|
|
|
|
MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
MetaWindow *window;
|
|
|
|
|
|
|
|
window = display->focus_window;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-09-04 04:15:46 +00:00
|
|
|
if (window != NULL &&
|
|
|
|
IN_TAB_CHAIN (window, type) &&
|
|
|
|
(workspace == NULL ||
|
2004-12-23 00:20:33 +00:00
|
|
|
meta_window_located_on_workspace (window, workspace)))
|
2002-09-04 04:15:46 +00:00
|
|
|
return window;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2002-03-17 17:22:23 +00:00
|
|
|
int
|
|
|
|
meta_resize_gravity_from_grab_op (MetaGrabOp op)
|
|
|
|
{
|
|
|
|
int gravity;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-03-17 17:22:23 +00:00
|
|
|
gravity = -1;
|
|
|
|
switch (op)
|
|
|
|
{
|
|
|
|
case META_GRAB_OP_RESIZING_SE:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_SE:
|
|
|
|
gravity = NorthWestGravity;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_S:
|
|
|
|
case META_GRAB_OP_RESIZING_S:
|
|
|
|
gravity = NorthGravity;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_SW:
|
|
|
|
case META_GRAB_OP_RESIZING_SW:
|
|
|
|
gravity = NorthEastGravity;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_N:
|
|
|
|
case META_GRAB_OP_RESIZING_N:
|
|
|
|
gravity = SouthGravity;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_NE:
|
|
|
|
case META_GRAB_OP_RESIZING_NE:
|
|
|
|
gravity = SouthWestGravity;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_NW:
|
|
|
|
case META_GRAB_OP_RESIZING_NW:
|
|
|
|
gravity = SouthEastGravity;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_E:
|
|
|
|
case META_GRAB_OP_RESIZING_E:
|
|
|
|
gravity = WestGravity;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_W:
|
|
|
|
case META_GRAB_OP_RESIZING_W:
|
|
|
|
gravity = EastGravity;
|
|
|
|
break;
|
2002-06-19 04:12:49 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
|
|
|
|
gravity = CenterGravity;
|
|
|
|
break;
|
2002-03-17 17:22:23 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return gravity;
|
|
|
|
}
|
2002-05-24 02:23:46 +00:00
|
|
|
|
2002-06-08 23:55:27 +00:00
|
|
|
void
|
|
|
|
meta_display_unmanage_screen (MetaDisplay *display,
|
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 17:27:24 +00:00
|
|
|
MetaScreen *screen,
|
|
|
|
guint32 timestamp)
|
2002-06-08 23:55:27 +00:00
|
|
|
{
|
|
|
|
meta_verbose ("Unmanaging screen %d on display %s\n",
|
|
|
|
screen->number, display->name);
|
2013-10-03 22:31:09 +00:00
|
|
|
meta_display_close (display, timestamp);
|
2002-06-08 23:55:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_unmanage_windows_for_screen (MetaDisplay *display,
|
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 17:27:24 +00:00
|
|
|
MetaScreen *screen,
|
|
|
|
guint32 timestamp)
|
2002-06-08 23:55:27 +00:00
|
|
|
{
|
|
|
|
GSList *tmp;
|
|
|
|
GSList *winlist;
|
|
|
|
|
2009-06-15 19:32:23 +00:00
|
|
|
winlist = meta_display_list_windows (display,
|
|
|
|
META_LIST_INCLUDE_OVERRIDE_REDIRECT);
|
2007-04-16 04:57:32 +00:00
|
|
|
winlist = g_slist_sort (winlist, meta_display_stack_cmp);
|
2012-01-19 19:06:57 +00:00
|
|
|
g_slist_foreach (winlist, (GFunc)g_object_ref, NULL);
|
2002-06-08 23:55:27 +00:00
|
|
|
|
|
|
|
/* Unmanage all windows */
|
|
|
|
tmp = winlist;
|
|
|
|
while (tmp != NULL)
|
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
|
|
|
{
|
2012-01-19 19:06:57 +00:00
|
|
|
MetaWindow *window = tmp->data;
|
|
|
|
|
|
|
|
/* Check if already unmanaged for safety - in particular, catch
|
|
|
|
* the case where unmanaging a parent window can cause attached
|
|
|
|
* dialogs to be (temporarily) unmanaged.
|
|
|
|
*/
|
|
|
|
if (!window->unmanaging)
|
|
|
|
meta_window_unmanage (window, timestamp);
|
|
|
|
g_object_unref (window);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-08 23:55:27 +00:00
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
g_slist_free (winlist);
|
|
|
|
}
|
2002-10-07 23:14:40 +00:00
|
|
|
|
2007-04-16 04:57:32 +00:00
|
|
|
int
|
|
|
|
meta_display_stack_cmp (const void *a,
|
|
|
|
const void *b)
|
|
|
|
{
|
|
|
|
MetaWindow *aw = (void*) a;
|
|
|
|
MetaWindow *bw = (void*) b;
|
|
|
|
|
2013-10-03 22:31:09 +00:00
|
|
|
return meta_stack_windows_cmp (aw->screen->stack, aw, bw);
|
2007-04-16 04:57:32 +00:00
|
|
|
}
|
|
|
|
|
2010-04-24 21:18:01 +00:00
|
|
|
/**
|
|
|
|
* meta_display_sort_windows_by_stacking:
|
|
|
|
* @display: a #MetaDisplay
|
|
|
|
* @windows: (element-type MetaWindow): Set of windows
|
|
|
|
*
|
|
|
|
* Sorts a set of windows according to their current stacking order. If windows
|
|
|
|
* from multiple screens are present in the set of input windows, then all the
|
|
|
|
* windows on screen 0 are sorted below all the windows on screen 1, and so forth.
|
|
|
|
* Since the stacking order of override-redirect windows isn't controlled by
|
|
|
|
* Metacity, if override-redirect windows are in the input, the result may not
|
|
|
|
* correspond to the actual stacking order in the X server.
|
|
|
|
*
|
|
|
|
* An example of using this would be to sort the list of transient dialogs for a
|
|
|
|
* window into their current stacking order.
|
|
|
|
*
|
2011-08-30 16:54:49 +00:00
|
|
|
* Returns: (transfer container) (element-type MetaWindow): Input windows sorted by stacking order, from lowest to highest
|
2010-04-24 21:18:01 +00:00
|
|
|
*/
|
|
|
|
GSList *
|
|
|
|
meta_display_sort_windows_by_stacking (MetaDisplay *display,
|
|
|
|
GSList *windows)
|
|
|
|
{
|
|
|
|
GSList *copy = g_slist_copy (windows);
|
|
|
|
|
|
|
|
copy = g_slist_sort (copy, meta_display_stack_cmp);
|
|
|
|
|
|
|
|
return copy;
|
|
|
|
}
|
|
|
|
|
2002-10-07 23:14:40 +00:00
|
|
|
static void
|
|
|
|
prefs_changed_callback (MetaPreference pref,
|
|
|
|
void *data)
|
|
|
|
{
|
2006-02-16 20:26:05 +00:00
|
|
|
MetaDisplay *display = data;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2014-08-14 19:04:00 +00:00
|
|
|
if (pref == META_PREF_FOCUS_MODE)
|
2014-08-14 18:48:21 +00:00
|
|
|
{
|
|
|
|
GSList *windows, *l;
|
|
|
|
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
|
|
|
|
|
|
|
|
for (l = windows; l; l = l->next)
|
|
|
|
{
|
|
|
|
MetaWindow *w = l->data;
|
|
|
|
meta_display_ungrab_focus_window_button (display, w);
|
|
|
|
if (w->type != META_WINDOW_DOCK)
|
|
|
|
meta_display_grab_focus_window_button (display, w);
|
2002-10-07 23:14:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (windows);
|
|
|
|
}
|
2003-01-28 15:07:43 +00:00
|
|
|
else if (pref == META_PREF_AUDIBLE_BELL)
|
|
|
|
{
|
|
|
|
meta_bell_set_audible (display, meta_prefs_bell_is_audible ());
|
|
|
|
}
|
2014-04-24 14:48:47 +00:00
|
|
|
else if (pref == META_PREF_CURSOR_THEME ||
|
|
|
|
pref == META_PREF_CURSOR_SIZE)
|
|
|
|
{
|
|
|
|
update_cursor_theme ();
|
|
|
|
}
|
2002-10-07 23:14:40 +00:00
|
|
|
}
|
2003-05-30 20:24:00 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_increment_focus_sentinel (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
unsigned long data[1];
|
|
|
|
|
|
|
|
data[0] = meta_display_get_current_time (display);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2003-05-30 20:24:00 +00:00
|
|
|
XChangeProperty (display->xdisplay,
|
2013-10-03 22:31:09 +00:00
|
|
|
display->screen->xroot,
|
Comprehensively rename to Mutter
Code:
All references in the code not related to themes, keybindings, or
GConf were changed from 'metacity' to 'mutter'. This includes, among other
things, strings, comments, the atoms used in the message protocol, and
the envvars used for debugging. The GConf schema file was reduced to
the 3 settings new to mutter.
The overall version was brought up to 2.27 to match current gnome.
Structure:
All files named '*metacity*' were renamed '*mutter*' with appropriate
changes in the automake system. Files removed are
doc/creating_themes, src/themes, doc/metacity-theme.dtd,
metacity.doap. These files will eventually end up in an external
gnome-wm-data module.
Installation location:
On the filesystem the mutter-plugindir was change from
$(libdir)/metacity/plugins/clutter to just $(libdir)/mutter/plugins.
The mutter-plugins.pc.in reflects these changes.
Note:
mutter.desktop.in and mutter-wm.desktop both continue to have
X-GNOME-WMSettingsModule=metacity set. This allows
gnome-control-center to continue using libmetacity.so for
configuration. This is fine since most the general keybindings and wm
settings are being read from /apps/metacity/* in gconf.
2009-06-10 10:29:20 +00:00
|
|
|
display->atom__MUTTER_SENTINEL,
|
2003-05-30 20:24:00 +00:00
|
|
|
XA_CARDINAL,
|
|
|
|
32, PropModeReplace, (guchar*) data, 1);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2003-05-30 20:24:00 +00:00
|
|
|
display->sentinel_counter += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_decrement_focus_sentinel (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
display->sentinel_counter -= 1;
|
|
|
|
|
|
|
|
if (display->sentinel_counter < 0)
|
|
|
|
display->sentinel_counter = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_display_focus_sentinel_clear (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
return (display->sentinel_counter == 0);
|
|
|
|
}
|
2004-10-04 21:09:08 +00:00
|
|
|
|
2014-03-20 19:29:30 +00:00
|
|
|
void
|
|
|
|
meta_display_sanity_check_timestamps (MetaDisplay *display,
|
|
|
|
guint32 timestamp)
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 17:14:16 +00:00
|
|
|
{
|
|
|
|
if (XSERVER_TIME_IS_BEFORE (timestamp, display->last_focus_time))
|
|
|
|
{
|
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
|
|
|
meta_warning ("last_focus_time (%u) is greater than comparison "
|
|
|
|
"timestamp (%u). This most likely represents a buggy "
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 17:14:16 +00:00
|
|
|
"client sending inaccurate timestamps in messages such as "
|
|
|
|
"_NET_ACTIVE_WINDOW. Trying to work around...\n",
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 16:32:33 +00:00
|
|
|
display->last_focus_time, timestamp);
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 17:14:16 +00:00
|
|
|
display->last_focus_time = timestamp;
|
|
|
|
}
|
|
|
|
if (XSERVER_TIME_IS_BEFORE (timestamp, display->last_user_time))
|
|
|
|
{
|
|
|
|
GSList *windows;
|
|
|
|
GSList *tmp;
|
|
|
|
|
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
|
|
|
meta_warning ("last_user_time (%u) is greater than comparison "
|
|
|
|
"timestamp (%u). This most likely represents a buggy "
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 17:14:16 +00:00
|
|
|
"client sending inaccurate timestamps in messages such as "
|
|
|
|
"_NET_ACTIVE_WINDOW. Trying to work around...\n",
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 16:32:33 +00:00
|
|
|
display->last_user_time, timestamp);
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 17:14:16 +00:00
|
|
|
display->last_user_time = timestamp;
|
|
|
|
|
2009-06-15 19:32:23 +00:00
|
|
|
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 17:14:16 +00:00
|
|
|
tmp = windows;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 17:14:16 +00:00
|
|
|
if (XSERVER_TIME_IS_BEFORE (timestamp, window->net_wm_user_time))
|
|
|
|
{
|
|
|
|
meta_warning ("%s appears to be one of the offending windows "
|
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
|
|
|
"with a timestamp of %u. Working around...\n",
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 17:14:16 +00:00
|
|
|
window->desc, window->net_wm_user_time);
|
2009-09-04 00:58:19 +00:00
|
|
|
meta_window_set_user_time (window, timestamp);
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 17:14:16 +00:00
|
|
|
}
|
2009-09-04 00:58:19 +00:00
|
|
|
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 17:14:16 +00:00
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (windows);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-12-23 06:44:56 +00:00
|
|
|
void
|
2014-05-02 13:34:02 +00:00
|
|
|
meta_display_set_input_focus_window (MetaDisplay *display,
|
2004-12-23 06:44:56 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
gboolean focus_frame,
|
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)
|
2004-12-23 06:44:56 +00:00
|
|
|
{
|
2013-05-23 19:54:39 +00:00
|
|
|
request_xserver_input_focus_change (display,
|
|
|
|
window->screen,
|
2013-08-12 16:04:34 +00:00
|
|
|
window,
|
2013-05-23 19:54:39 +00:00
|
|
|
focus_frame ? window->frame->xwindow : window->xwindow,
|
|
|
|
timestamp);
|
2011-04-26 12:12:04 +00:00
|
|
|
}
|
|
|
|
|
2013-05-23 20:21:24 +00:00
|
|
|
void
|
2014-02-23 17:28:51 +00:00
|
|
|
meta_display_set_input_focus_xwindow (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
Window window,
|
|
|
|
guint32 timestamp)
|
2013-05-23 20:21:24 +00:00
|
|
|
{
|
|
|
|
request_xserver_input_focus_change (display,
|
|
|
|
screen,
|
2013-08-12 16:04:34 +00:00
|
|
|
NULL,
|
2013-05-23 20:21:24 +00:00
|
|
|
window,
|
|
|
|
timestamp);
|
|
|
|
}
|
|
|
|
|
2004-10-04 21:09:08 +00:00
|
|
|
void
|
2013-05-23 19:54:39 +00:00
|
|
|
meta_display_focus_the_no_focus_window (MetaDisplay *display,
|
2005-12-28 06:24:30 +00:00
|
|
|
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)
|
2004-10-04 21:09:08 +00:00
|
|
|
{
|
2013-05-23 19:54:39 +00:00
|
|
|
request_xserver_input_focus_change (display,
|
|
|
|
screen,
|
2013-08-12 16:04:34 +00:00
|
|
|
NULL,
|
2013-05-23 19:54:39 +00:00
|
|
|
screen->no_focus_window,
|
|
|
|
timestamp);
|
2004-10-04 21:09:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_remove_autoraise_callback (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
if (display->autoraise_timeout_id != 0)
|
|
|
|
{
|
|
|
|
g_source_remove (display->autoraise_timeout_id);
|
|
|
|
display->autoraise_timeout_id = 0;
|
|
|
|
display->autoraise_window = NULL;
|
|
|
|
}
|
|
|
|
}
|
2008-05-19 00:00:09 +00:00
|
|
|
|
2008-12-02 23:13:11 +00:00
|
|
|
void
|
|
|
|
meta_display_overlay_key_activate (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
g_signal_emit (display, display_signals[OVERLAY_KEY], 0);
|
|
|
|
}
|
|
|
|
|
2012-08-28 13:28:11 +00:00
|
|
|
void
|
2013-10-03 22:03:53 +00:00
|
|
|
meta_display_accelerator_activate (MetaDisplay *display,
|
|
|
|
guint action,
|
|
|
|
ClutterKeyEvent *event)
|
2012-08-28 13:28:11 +00:00
|
|
|
{
|
|
|
|
g_signal_emit (display, display_signals[ACCELERATOR_ACTIVATED],
|
2013-10-03 22:03:53 +00:00
|
|
|
0, action,
|
|
|
|
clutter_input_device_get_device_id (event->device),
|
|
|
|
event->time);
|
2012-08-28 13:28:11 +00:00
|
|
|
}
|
|
|
|
|
2013-04-10 11:34:26 +00:00
|
|
|
gboolean
|
|
|
|
meta_display_modifiers_accelerator_activate (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
gboolean freeze;
|
|
|
|
|
|
|
|
g_signal_emit (display, display_signals[MODIFIERS_ACCELERATOR_ACTIVATED], 0, &freeze);
|
|
|
|
|
|
|
|
return freeze;
|
|
|
|
}
|
|
|
|
|
2012-12-21 02:30:49 +00:00
|
|
|
/**
|
|
|
|
* meta_display_get_xinput_opcode: (skip)
|
2013-02-15 18:42:08 +00:00
|
|
|
* @display: a #MetaDisplay
|
2012-12-21 02:30:49 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
meta_display_get_xinput_opcode (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
return display->xinput_opcode;
|
|
|
|
}
|
|
|
|
|
2012-07-30 18:57:53 +00:00
|
|
|
/**
|
|
|
|
* meta_display_supports_extended_barriers:
|
|
|
|
* @display: a #MetaDisplay
|
|
|
|
*
|
2013-02-15 18:42:08 +00:00
|
|
|
* Returns: whether the X server supports extended barrier
|
2012-07-30 18:57:53 +00:00
|
|
|
* features as defined in version 2.3 of the XInput 2
|
|
|
|
* specification.
|
|
|
|
*
|
|
|
|
* Clients should use this method to determine whether their
|
|
|
|
* interfaces should depend on new barrier features.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
meta_display_supports_extended_barriers (MetaDisplay *display)
|
|
|
|
{
|
2013-09-16 07:34:27 +00:00
|
|
|
return META_DISPLAY_HAS_XINPUT_23 (display) && !meta_is_wayland_compositor ();
|
2012-07-30 18:57:53 +00:00
|
|
|
}
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_display_get_xdisplay: (skip)
|
2013-02-15 18:42:08 +00:00
|
|
|
* @display: a #MetaDisplay
|
2010-09-01 19:39:53 +00:00
|
|
|
*
|
|
|
|
*/
|
2008-05-19 00:00:09 +00:00
|
|
|
Display *
|
|
|
|
meta_display_get_xdisplay (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
return display->xdisplay;
|
|
|
|
}
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_display_get_compositor: (skip)
|
2013-02-15 18:42:08 +00:00
|
|
|
* @display: a #MetaDisplay
|
2010-09-01 19:39:53 +00:00
|
|
|
*
|
|
|
|
*/
|
2008-05-19 00:00:09 +00:00
|
|
|
MetaCompositor *
|
|
|
|
meta_display_get_compositor (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
return display->compositor;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_display_has_shape (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
return META_DISPLAY_HAS_SHAPE (display);
|
|
|
|
}
|
|
|
|
|
2008-11-17 21:34:28 +00:00
|
|
|
/**
|
|
|
|
* meta_display_get_focus_window:
|
|
|
|
* @display: a #MetaDisplay
|
|
|
|
*
|
2011-04-26 12:12:04 +00:00
|
|
|
* Get our best guess as to the "currently" focused window (that is,
|
|
|
|
* the window that we expect will be focused at the point when the X
|
|
|
|
* server processes our next request).
|
2008-11-17 21:34:28 +00:00
|
|
|
*
|
|
|
|
* Return Value: (transfer none): The current focus window
|
|
|
|
*/
|
2008-05-19 00:00:09 +00:00
|
|
|
MetaWindow *
|
|
|
|
meta_display_get_focus_window (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
return display->focus_window;
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
int
|
2008-05-19 00:00:09 +00:00
|
|
|
meta_display_get_damage_event_base (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
return display->damage_event_base;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
meta_display_get_shape_event_base (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
return display->shape_event_base;
|
|
|
|
}
|
2008-08-18 14:10:13 +00:00
|
|
|
|
2012-04-14 13:12:48 +00:00
|
|
|
/**
|
|
|
|
* meta_display_clear_mouse_mode:
|
|
|
|
* @display: a #MetaDisplay
|
|
|
|
*
|
|
|
|
* Sets the mouse-mode flag to %FALSE, which means that motion events are
|
|
|
|
* no longer ignored in mouse or sloppy focus.
|
|
|
|
* This is an internal function. It should be used only for reimplementing
|
|
|
|
* keybindings, and only in a manner compatible with core code.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
meta_display_clear_mouse_mode (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
display->mouse_mode = FALSE;
|
|
|
|
}
|
2014-04-23 14:41:09 +00:00
|
|
|
|
|
|
|
Cursor
|
|
|
|
meta_display_create_x_cursor (MetaDisplay *display,
|
|
|
|
MetaCursor cursor)
|
|
|
|
{
|
|
|
|
return meta_cursor_create_x_cursor (display->xdisplay, cursor);
|
|
|
|
}
|
2014-06-19 20:28:48 +00:00
|
|
|
|
|
|
|
MetaGestureTracker *
|
|
|
|
meta_display_get_gesture_tracker (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
return display->gesture_tracker;
|
|
|
|
}
|
2014-05-08 22:35:49 +00:00
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_display_show_restart_message (MetaDisplay *display,
|
|
|
|
const char *message)
|
|
|
|
{
|
|
|
|
gboolean result = FALSE;
|
|
|
|
|
|
|
|
g_signal_emit (display,
|
|
|
|
display_signals[SHOW_RESTART_MESSAGE], 0,
|
|
|
|
message, &result);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_display_request_restart (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
gboolean result = FALSE;
|
|
|
|
|
|
|
|
g_signal_emit (display,
|
|
|
|
display_signals[RESTART], 0,
|
|
|
|
&result);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
2014-07-21 23:14:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* meta_display_is_pointer_emulating_sequence:
|
|
|
|
* @display: the display
|
|
|
|
* @sequence: (nullable): a #ClutterEventSequence
|
|
|
|
*
|
|
|
|
* Tells whether the event sequence is the used for pointer emulation
|
|
|
|
* and single-touch interaction.
|
|
|
|
*
|
|
|
|
* Returns: #TRUE if the sequence emulates pointer behavior
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
meta_display_is_pointer_emulating_sequence (MetaDisplay *display,
|
|
|
|
ClutterEventSequence *sequence)
|
|
|
|
{
|
|
|
|
if (!sequence)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return display->pointer_emulating_sequence == sequence;
|
|
|
|
}
|