2006-10-01 18:30:10 -04:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
Comprehensively rename to Mutter
Code:
All references in the code not related to themes, keybindings, or
GConf were changed from 'metacity' to 'mutter'. This includes, among other
things, strings, comments, the atoms used in the message protocol, and
the envvars used for debugging. The GConf schema file was reduced to
the 3 settings new to mutter.
The overall version was brought up to 2.27 to match current gnome.
Structure:
All files named '*metacity*' were renamed '*mutter*' with appropriate
changes in the automake system. Files removed are
doc/creating_themes, src/themes, doc/metacity-theme.dtd,
metacity.doap. These files will eventually end up in an external
gnome-wm-data module.
Installation location:
On the filesystem the mutter-plugindir was change from
$(libdir)/metacity/plugins/clutter to just $(libdir)/mutter/plugins.
The mutter-plugins.pc.in reflects these changes.
Note:
mutter.desktop.in and mutter-wm.desktop both continue to have
X-GNOME-WMSettingsModule=metacity set. This allows
gnome-control-center to continue using libmetacity.so for
configuration. This is fine since most the general keybindings and wm
settings are being read from /apps/metacity/* in gconf.
2009-06-10 06:29:20 -04:00
|
|
|
/* Mutter X screen handler */
|
2001-05-30 11:36:31 -04:00
|
|
|
|
|
|
|
/*
|
2002-06-08 19:55:27 -04:00
|
|
|
* Copyright (C) 2001, 2002 Havoc Pennington
|
2003-01-22 20:53:18 -05:00
|
|
|
* Copyright (C) 2002, 2003 Red Hat Inc.
|
2002-06-08 19:55:27 -04:00
|
|
|
* Some ICCCM manager selection code derived from fvwm2,
|
2002-07-10 10:41:19 -04:00
|
|
|
* Copyright (C) 2001 Dominik Vogt, Matthias Clasen, and fvwm2 team
|
2003-02-23 12:09:46 -05:00
|
|
|
* Copyright (C) 2003 Rob Adams
|
2006-01-10 14:43:21 -05:00
|
|
|
* Copyright (C) 2004-2006 Elijah Newren
|
2001-05-30 11:36:31 -04:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*/
|
2001-05-31 02:42:58 -04:00
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
#include <config.h>
|
2008-05-18 20:00:09 -04:00
|
|
|
#include "screen-private.h"
|
2001-05-30 11:36:31 -04:00
|
|
|
#include "util.h"
|
2001-05-30 23:30:58 -04:00
|
|
|
#include "errors.h"
|
2008-05-18 20:00:09 -04:00
|
|
|
#include "window-private.h"
|
|
|
|
#include "frame-private.h"
|
2001-12-09 22:55:26 -05:00
|
|
|
#include "prefs.h"
|
2008-09-18 11:09:11 -04:00
|
|
|
#include "workspace-private.h"
|
2009-01-29 09:16:01 -05:00
|
|
|
#include "keybindings-private.h"
|
2001-06-10 14:46:46 -04:00
|
|
|
#include "stack.h"
|
2002-05-16 00:03:36 -04:00
|
|
|
#include "xprops.h"
|
2003-11-20 21:32:05 -05:00
|
|
|
#include "compositor.h"
|
2009-07-02 11:19:02 -04:00
|
|
|
#include "mutter-marshal.h"
|
|
|
|
#include "mutter-enum-types.h"
|
2001-05-31 23:00:01 -04:00
|
|
|
|
2002-09-27 16:28:34 -04:00
|
|
|
#ifdef HAVE_SOLARIS_XINERAMA
|
|
|
|
#include <X11/extensions/xinerama.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_XFREE_XINERAMA
|
2002-04-21 15:35:02 -04:00
|
|
|
#include <X11/extensions/Xinerama.h>
|
|
|
|
#endif
|
|
|
|
|
2001-06-09 23:17:15 -04:00
|
|
|
#include <X11/Xatom.h>
|
2001-05-31 23:00:01 -04:00
|
|
|
#include <locale.h>
|
|
|
|
#include <string.h>
|
2002-06-08 19:55:27 -04:00
|
|
|
#include <stdio.h>
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2001-06-02 21:33:27 -04:00
|
|
|
static char* get_screen_name (MetaDisplay *display,
|
|
|
|
int number);
|
|
|
|
|
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 13:27:24 -04:00
|
|
|
static void update_num_workspaces (MetaScreen *screen,
|
|
|
|
guint32 timestamp);
|
2001-12-10 02:48:21 -05:00
|
|
|
static void update_focus_mode (MetaScreen *screen);
|
2003-02-14 02:03:46 -05:00
|
|
|
static void set_workspace_names (MetaScreen *screen);
|
2001-12-09 22:55:26 -05:00
|
|
|
static void prefs_changed_callback (MetaPreference pref,
|
|
|
|
gpointer data);
|
2001-06-02 21:33:27 -04:00
|
|
|
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
static void set_desktop_geometry_hint (MetaScreen *screen);
|
|
|
|
static void set_desktop_viewport_hint (MetaScreen *screen);
|
|
|
|
|
2002-10-25 19:35:50 -04:00
|
|
|
#ifdef HAVE_STARTUP_NOTIFICATION
|
|
|
|
static void meta_screen_sn_event (SnMonitorEvent *event,
|
|
|
|
void *user_data);
|
|
|
|
#endif
|
|
|
|
|
2008-11-17 17:22:28 -05:00
|
|
|
enum
|
|
|
|
{
|
2009-05-05 04:39:29 -04:00
|
|
|
PROP_N_WORKSPACES = 1,
|
|
|
|
PROP_KEYBOARD_GRABBED,
|
2008-11-17 17:22:28 -05:00
|
|
|
};
|
|
|
|
|
2009-03-12 17:07:27 -04:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
RESTACKED,
|
2009-03-13 17:06:04 -04:00
|
|
|
TOGGLE_RECORDING,
|
2009-07-02 11:19:02 -04:00
|
|
|
WORKSPACE_ADDED,
|
|
|
|
WORKSPACE_REMOVED,
|
|
|
|
WORKSPACE_SWITCHED,
|
2009-08-02 00:42:34 -04:00
|
|
|
STARTUP_SEQUENCE_CHANGED,
|
2009-09-17 04:49:23 -04:00
|
|
|
WORKAREAS_CHANGED,
|
2009-03-12 17:07:27 -04:00
|
|
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint screen_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
2008-11-17 15:56:34 -05:00
|
|
|
G_DEFINE_TYPE (MetaScreen, meta_screen, G_TYPE_OBJECT);
|
|
|
|
|
2008-11-17 17:22:28 -05:00
|
|
|
static void
|
|
|
|
meta_screen_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
MetaScreen *screen = META_SCREEN (object);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_screen_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
MetaScreen *screen = META_SCREEN (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_N_WORKSPACES:
|
|
|
|
g_value_set_int (value, meta_screen_get_n_workspaces (screen));
|
|
|
|
break;
|
2009-05-05 04:39:29 -04:00
|
|
|
case PROP_KEYBOARD_GRABBED:
|
|
|
|
g_value_set_boolean (value, screen->all_keys_grabbed ? TRUE : FALSE);
|
|
|
|
break;
|
2008-11-17 17:22:28 -05:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-17 15:56:34 -05:00
|
|
|
static void
|
|
|
|
meta_screen_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
/* Actual freeing done in meta_screen_free() for now */
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_screen_class_init (MetaScreenClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2008-11-17 17:22:28 -05:00
|
|
|
GParamSpec *pspec;
|
2008-11-17 15:56:34 -05:00
|
|
|
|
2008-11-17 17:22:28 -05:00
|
|
|
object_class->get_property = meta_screen_get_property;
|
|
|
|
object_class->set_property = meta_screen_set_property;
|
2008-11-17 15:56:34 -05:00
|
|
|
object_class->finalize = meta_screen_finalize;
|
2008-11-17 17:22:28 -05:00
|
|
|
|
2009-03-12 17:07:27 -04:00
|
|
|
screen_signals[RESTACKED] =
|
|
|
|
g_signal_new ("restacked",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (MetaScreenClass, restacked),
|
|
|
|
NULL, NULL,
|
|
|
|
g_cclosure_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
2008-11-17 17:22:28 -05:00
|
|
|
pspec = g_param_spec_int ("n-workspaces",
|
|
|
|
"N Workspaces",
|
|
|
|
"Number of workspaces",
|
|
|
|
1, G_MAXINT, 1,
|
|
|
|
G_PARAM_READABLE);
|
|
|
|
|
2009-07-02 11:19:02 -04:00
|
|
|
screen_signals[WORKSPACE_ADDED] =
|
|
|
|
g_signal_new ("workspace-added",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
|
|
|
NULL, NULL,
|
|
|
|
g_cclosure_marshal_VOID__INT,
|
|
|
|
G_TYPE_NONE,
|
|
|
|
1,
|
|
|
|
G_TYPE_INT);
|
|
|
|
|
|
|
|
screen_signals[WORKSPACE_REMOVED] =
|
|
|
|
g_signal_new ("workspace-removed",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
|
|
|
NULL, NULL,
|
|
|
|
g_cclosure_marshal_VOID__INT,
|
|
|
|
G_TYPE_NONE,
|
|
|
|
1,
|
|
|
|
G_TYPE_INT);
|
|
|
|
|
|
|
|
screen_signals[WORKSPACE_SWITCHED] =
|
|
|
|
g_signal_new ("workspace-switched",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
|
|
|
NULL, NULL,
|
|
|
|
_mutter_marshal_VOID__INT_INT_ENUM,
|
|
|
|
G_TYPE_NONE,
|
|
|
|
3,
|
|
|
|
G_TYPE_INT,
|
|
|
|
G_TYPE_INT,
|
|
|
|
MUTTER_TYPE_MOTION_DIRECTION);
|
|
|
|
|
2009-08-02 00:42:34 -04:00
|
|
|
screen_signals[STARTUP_SEQUENCE_CHANGED] =
|
|
|
|
g_signal_new ("startup-sequence-changed",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
|
|
|
NULL, NULL,
|
|
|
|
g_cclosure_marshal_VOID__POINTER,
|
|
|
|
G_TYPE_NONE, 1, G_TYPE_POINTER);
|
|
|
|
|
2009-03-13 17:06:04 -04:00
|
|
|
screen_signals[TOGGLE_RECORDING] =
|
|
|
|
g_signal_new ("toggle-recording",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
|
|
|
NULL, NULL,
|
|
|
|
g_cclosure_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
2009-09-17 04:49:23 -04:00
|
|
|
screen_signals[WORKAREAS_CHANGED] =
|
|
|
|
g_signal_new ("workareas-changed",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (MetaScreenClass, workareas_changed),
|
|
|
|
NULL, NULL,
|
|
|
|
g_cclosure_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
2008-11-17 17:22:28 -05:00
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_N_WORKSPACES,
|
|
|
|
pspec);
|
2009-05-05 04:39:29 -04:00
|
|
|
|
|
|
|
pspec = g_param_spec_boolean ("keyboard-grabbed",
|
|
|
|
"Keyboard grabbed",
|
|
|
|
"Whether the keyboard is grabbed",
|
|
|
|
FALSE,
|
|
|
|
G_PARAM_READABLE);
|
|
|
|
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_KEYBOARD_GRABBED,
|
|
|
|
pspec);
|
2008-11-17 15:56:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_screen_init (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-06-09 23:17:15 -04:00
|
|
|
static int
|
|
|
|
set_wm_check_hint (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
unsigned long data[1];
|
|
|
|
|
2001-06-10 15:23:28 -04:00
|
|
|
g_return_val_if_fail (screen->display->leader_window != None, 0);
|
|
|
|
|
2001-06-09 23:17:15 -04:00
|
|
|
data[0] = screen->display->leader_window;
|
|
|
|
|
|
|
|
XChangeProperty (screen->display->xdisplay, screen->xroot,
|
2008-05-02 14:49:01 -04:00
|
|
|
screen->display->atom__NET_SUPPORTING_WM_CHECK,
|
2001-06-09 23:17:15 -04:00
|
|
|
XA_WINDOW,
|
|
|
|
32, PropModeReplace, (guchar*) data, 1);
|
2001-06-23 01:49:35 -04:00
|
|
|
|
2001-06-09 23:17:15 -04:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2009-07-09 10:26:20 -04:00
|
|
|
static void
|
|
|
|
unset_wm_check_hint (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
XDeleteProperty (screen->display->xdisplay, screen->xroot,
|
|
|
|
screen->display->atom__NET_SUPPORTING_WM_CHECK);
|
|
|
|
}
|
|
|
|
|
2001-06-09 23:17:15 -04:00
|
|
|
static int
|
|
|
|
set_supported_hint (MetaScreen *screen)
|
|
|
|
{
|
2008-05-02 14:49:01 -04:00
|
|
|
Atom atoms[] = {
|
|
|
|
#define EWMH_ATOMS_ONLY
|
|
|
|
#define item(x) screen->display->atom_##x,
|
|
|
|
#include "atomnames.h"
|
|
|
|
#undef item
|
|
|
|
#undef EWMH_ATOMS_ONLY
|
|
|
|
};
|
|
|
|
|
2001-06-09 23:17:15 -04:00
|
|
|
XChangeProperty (screen->display->xdisplay, screen->xroot,
|
2008-05-02 14:49:01 -04:00
|
|
|
screen->display->atom__NET_SUPPORTED,
|
2001-06-09 23:17:15 -04:00
|
|
|
XA_ATOM,
|
2008-05-02 14:49:01 -04:00
|
|
|
32, PropModeReplace,
|
|
|
|
(guchar*) atoms, G_N_ELEMENTS(atoms));
|
2001-06-23 01:49:35 -04:00
|
|
|
|
2001-06-09 23:17:15 -04:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2001-08-19 21:42:44 -04:00
|
|
|
static int
|
|
|
|
set_wm_icon_size_hint (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
#define N_VALS 6
|
|
|
|
gulong vals[N_VALS];
|
|
|
|
|
|
|
|
/* min width, min height, max w, max h, width inc, height inc */
|
|
|
|
vals[0] = META_ICON_WIDTH;
|
|
|
|
vals[1] = META_ICON_HEIGHT;
|
|
|
|
vals[2] = META_ICON_WIDTH;
|
|
|
|
vals[3] = META_ICON_HEIGHT;
|
|
|
|
vals[4] = 0;
|
|
|
|
vals[5] = 0;
|
|
|
|
|
|
|
|
XChangeProperty (screen->display->xdisplay, screen->xroot,
|
2008-05-02 14:49:01 -04:00
|
|
|
screen->display->atom_WM_ICON_SIZE,
|
2001-08-19 21:42:44 -04:00
|
|
|
XA_CARDINAL,
|
|
|
|
32, PropModeReplace, (guchar*) vals, N_VALS);
|
|
|
|
|
|
|
|
return Success;
|
|
|
|
#undef N_VALS
|
|
|
|
}
|
|
|
|
|
2002-09-28 22:50:24 -04:00
|
|
|
static void
|
2009-08-31 09:52:16 -04:00
|
|
|
reload_monitor_infos (MetaScreen *screen)
|
2002-09-28 22:50:24 -04:00
|
|
|
{
|
|
|
|
MetaDisplay *display;
|
|
|
|
|
2006-05-15 14:37:36 -04:00
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
tmp = screen->workspaces;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWorkspace *space = tmp->data;
|
|
|
|
|
|
|
|
meta_workspace_invalidate_work_area (space);
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-09-28 22:50:24 -04:00
|
|
|
display = screen->display;
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
if (screen->monitor_infos)
|
|
|
|
g_free (screen->monitor_infos);
|
2002-09-28 22:50:24 -04:00
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
screen->monitor_infos = NULL;
|
|
|
|
screen->n_monitor_infos = 0;
|
|
|
|
screen->last_monitor_index = 0;
|
2002-09-28 22:50:24 -04:00
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
screen->display->monitor_cache_invalidated = TRUE;
|
2009-08-13 18:57:35 -04:00
|
|
|
|
|
|
|
if (g_getenv ("MUTTER_DEBUG_XINERAMA"))
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_XINERAMA,
|
|
|
|
"Pretending a single monitor has two Xinerama screens\n");
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
screen->monitor_infos = g_new (MetaMonitorInfo, 2);
|
|
|
|
screen->n_monitor_infos = 2;
|
2009-08-13 18:57:35 -04:00
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
screen->monitor_infos[0].number = 0;
|
|
|
|
screen->monitor_infos[0].rect = screen->rect;
|
|
|
|
screen->monitor_infos[0].rect.width = screen->rect.width / 2;
|
2009-08-13 18:57:35 -04:00
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
screen->monitor_infos[1].number = 1;
|
|
|
|
screen->monitor_infos[1].rect = screen->rect;
|
|
|
|
screen->monitor_infos[1].rect.x = screen->rect.width / 2;
|
|
|
|
screen->monitor_infos[1].rect.width = screen->rect.width / 2;
|
2009-08-13 18:57:35 -04:00
|
|
|
}
|
2002-09-28 22:50:24 -04:00
|
|
|
|
|
|
|
#ifdef HAVE_XFREE_XINERAMA
|
2009-08-31 09:52:16 -04:00
|
|
|
if (screen->n_monitor_infos == 0 &&
|
2009-08-13 18:57:35 -04:00
|
|
|
XineramaIsActive (display->xdisplay))
|
2002-09-28 22:50:24 -04:00
|
|
|
{
|
|
|
|
XineramaScreenInfo *infos;
|
|
|
|
int n_infos;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
n_infos = 0;
|
|
|
|
infos = XineramaQueryScreens (display->xdisplay, &n_infos);
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_XINERAMA,
|
|
|
|
"Found %d Xinerama screens on display %s\n",
|
|
|
|
n_infos, display->name);
|
|
|
|
|
|
|
|
if (n_infos > 0)
|
|
|
|
{
|
2009-08-31 09:52:16 -04:00
|
|
|
screen->monitor_infos = g_new (MetaMonitorInfo, n_infos);
|
|
|
|
screen->n_monitor_infos = n_infos;
|
2002-09-28 22:50:24 -04:00
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < n_infos)
|
|
|
|
{
|
2009-08-31 09:52:16 -04:00
|
|
|
screen->monitor_infos[i].number = infos[i].screen_number;
|
|
|
|
screen->monitor_infos[i].rect.x = infos[i].x_org;
|
|
|
|
screen->monitor_infos[i].rect.y = infos[i].y_org;
|
|
|
|
screen->monitor_infos[i].rect.width = infos[i].width;
|
|
|
|
screen->monitor_infos[i].rect.height = infos[i].height;
|
2002-09-28 22:50:24 -04:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_XINERAMA,
|
2009-08-31 09:52:16 -04:00
|
|
|
"Monitor %d is %d,%d %d x %d\n",
|
|
|
|
screen->monitor_infos[i].number,
|
|
|
|
screen->monitor_infos[i].rect.x,
|
|
|
|
screen->monitor_infos[i].rect.y,
|
|
|
|
screen->monitor_infos[i].rect.width,
|
|
|
|
screen->monitor_infos[i].rect.height);
|
2002-09-28 22:50:24 -04:00
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_XFree (infos);
|
|
|
|
}
|
2009-08-31 09:52:16 -04:00
|
|
|
else if (screen->n_monitor_infos > 0)
|
2002-09-28 22:50:24 -04:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_XINERAMA,
|
|
|
|
"No XFree86 Xinerama extension or XFree86 Xinerama inactive on display %s\n",
|
|
|
|
display->name);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
meta_topic (META_DEBUG_XINERAMA,
|
Comprehensively rename to Mutter
Code:
All references in the code not related to themes, keybindings, or
GConf were changed from 'metacity' to 'mutter'. This includes, among other
things, strings, comments, the atoms used in the message protocol, and
the envvars used for debugging. The GConf schema file was reduced to
the 3 settings new to mutter.
The overall version was brought up to 2.27 to match current gnome.
Structure:
All files named '*metacity*' were renamed '*mutter*' with appropriate
changes in the automake system. Files removed are
doc/creating_themes, src/themes, doc/metacity-theme.dtd,
metacity.doap. These files will eventually end up in an external
gnome-wm-data module.
Installation location:
On the filesystem the mutter-plugindir was change from
$(libdir)/metacity/plugins/clutter to just $(libdir)/mutter/plugins.
The mutter-plugins.pc.in reflects these changes.
Note:
mutter.desktop.in and mutter-wm.desktop both continue to have
X-GNOME-WMSettingsModule=metacity set. This allows
gnome-control-center to continue using libmetacity.so for
configuration. This is fine since most the general keybindings and wm
settings are being read from /apps/metacity/* in gconf.
2009-06-10 06:29:20 -04:00
|
|
|
"Mutter compiled without XFree86 Xinerama support\n");
|
2002-09-28 22:50:24 -04:00
|
|
|
#endif /* HAVE_XFREE_XINERAMA */
|
|
|
|
|
|
|
|
#ifdef HAVE_SOLARIS_XINERAMA
|
|
|
|
/* This code from GDK, Copyright (C) 2002 Sun Microsystems */
|
2009-08-31 09:52:16 -04:00
|
|
|
if (screen->n_monitor_infos == 0 &&
|
2002-09-28 22:50:24 -04:00
|
|
|
XineramaGetState (screen->display->xdisplay,
|
|
|
|
screen->number))
|
|
|
|
{
|
|
|
|
XRectangle monitors[MAXFRAMEBUFFERS];
|
|
|
|
unsigned char hints[16];
|
|
|
|
int result;
|
|
|
|
int n_monitors;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
n_monitors = 0;
|
2002-09-30 09:58:56 -04:00
|
|
|
result = XineramaGetInfo (screen->display->xdisplay,
|
2002-09-28 22:50:24 -04:00
|
|
|
screen->number,
|
|
|
|
monitors, hints,
|
|
|
|
&n_monitors);
|
|
|
|
/* Yes I know it should be Success but the current implementation
|
|
|
|
* returns the num of monitor
|
|
|
|
*/
|
|
|
|
if (result > 0)
|
|
|
|
{
|
|
|
|
g_assert (n_monitors > 0);
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
screen->monitor_infos = g_new (MetaMonitorInfo, n_monitors);
|
|
|
|
screen->n_monitor_infos = n_monitors;
|
2002-09-28 22:50:24 -04:00
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < n_monitors)
|
|
|
|
{
|
2009-08-31 09:52:16 -04:00
|
|
|
screen->monitor_infos[i].number = i;
|
|
|
|
screen->monitor_infos[i].rect.x = monitors[i].x;
|
|
|
|
screen->monitor_infos[i].rect.y = monitors[i].y;
|
|
|
|
screen->monitor_infos[i].rect.width = monitors[i].width;
|
|
|
|
screen->monitor_infos[i].rect.height = monitors[i].height;
|
2002-09-28 22:50:24 -04:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_XINERAMA,
|
2009-08-31 09:52:16 -04:00
|
|
|
"Monitor %d is %d,%d %d x %d\n",
|
|
|
|
screen->monitor_infos[i].number,
|
|
|
|
screen->monitor_infos[i].rect.x,
|
|
|
|
screen->monitor_infos[i].rect.y,
|
|
|
|
screen->monitor_infos[i].rect.width,
|
|
|
|
screen->monitor_infos[i].rect.height);
|
2002-09-28 22:50:24 -04:00
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-08-31 09:52:16 -04:00
|
|
|
else if (screen->n_monitor_infos == 0)
|
2002-09-28 22:50:24 -04:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_XINERAMA,
|
|
|
|
"No Solaris Xinerama extension or Solaris Xinerama inactive on display %s\n",
|
|
|
|
display->name);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
meta_topic (META_DEBUG_XINERAMA,
|
Comprehensively rename to Mutter
Code:
All references in the code not related to themes, keybindings, or
GConf were changed from 'metacity' to 'mutter'. This includes, among other
things, strings, comments, the atoms used in the message protocol, and
the envvars used for debugging. The GConf schema file was reduced to
the 3 settings new to mutter.
The overall version was brought up to 2.27 to match current gnome.
Structure:
All files named '*metacity*' were renamed '*mutter*' with appropriate
changes in the automake system. Files removed are
doc/creating_themes, src/themes, doc/metacity-theme.dtd,
metacity.doap. These files will eventually end up in an external
gnome-wm-data module.
Installation location:
On the filesystem the mutter-plugindir was change from
$(libdir)/metacity/plugins/clutter to just $(libdir)/mutter/plugins.
The mutter-plugins.pc.in reflects these changes.
Note:
mutter.desktop.in and mutter-wm.desktop both continue to have
X-GNOME-WMSettingsModule=metacity set. This allows
gnome-control-center to continue using libmetacity.so for
configuration. This is fine since most the general keybindings and wm
settings are being read from /apps/metacity/* in gconf.
2009-06-10 06:29:20 -04:00
|
|
|
"Mutter compiled without Solaris Xinerama support\n");
|
2002-09-28 22:50:24 -04:00
|
|
|
#endif /* HAVE_SOLARIS_XINERAMA */
|
|
|
|
|
|
|
|
|
|
|
|
/* If no Xinerama, fill in the single screen info so
|
|
|
|
* we can use the field unconditionally
|
|
|
|
*/
|
2009-08-31 09:52:16 -04:00
|
|
|
if (screen->n_monitor_infos == 0)
|
2002-09-28 22:50:24 -04:00
|
|
|
{
|
2009-08-13 18:57:35 -04:00
|
|
|
meta_topic (META_DEBUG_XINERAMA,
|
|
|
|
"No Xinerama screens, using default screen info\n");
|
2002-09-28 22:50:24 -04:00
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
screen->monitor_infos = g_new (MetaMonitorInfo, 1);
|
|
|
|
screen->n_monitor_infos = 1;
|
2002-09-28 22:50:24 -04:00
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
screen->monitor_infos[0].number = 0;
|
|
|
|
screen->monitor_infos[0].rect = screen->rect;
|
2002-09-28 22:50:24 -04:00
|
|
|
}
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
g_assert (screen->n_monitor_infos > 0);
|
|
|
|
g_assert (screen->monitor_infos != NULL);
|
2002-09-28 22:50:24 -04:00
|
|
|
}
|
|
|
|
|
2008-11-03 09:50:22 -05:00
|
|
|
/* The guard window allows us to leave minimized windows mapped so
|
|
|
|
* that compositor code may provide live previews of them.
|
|
|
|
* Instead of being unmapped/withdrawn, they get pushed underneath
|
|
|
|
* the guard window. */
|
|
|
|
static Window
|
|
|
|
create_guard_window (Display *xdisplay, MetaScreen *screen)
|
|
|
|
{
|
|
|
|
XSetWindowAttributes attributes;
|
|
|
|
Window guard_window;
|
2009-06-13 16:45:32 -04:00
|
|
|
gulong create_serial;
|
2008-11-03 09:50:22 -05:00
|
|
|
|
|
|
|
attributes.event_mask = NoEventMask;
|
|
|
|
attributes.override_redirect = True;
|
|
|
|
attributes.background_pixel = BlackPixel (xdisplay, screen->number);
|
|
|
|
|
2009-06-13 16:45:32 -04:00
|
|
|
/* We have to call record_add() after we have the new window ID,
|
|
|
|
* so save the serial for the CreateWindow request until then */
|
|
|
|
create_serial = XNextRequest(xdisplay);
|
2008-11-03 09:50:22 -05:00
|
|
|
guard_window =
|
|
|
|
XCreateWindow (xdisplay,
|
|
|
|
screen->xroot,
|
|
|
|
0, /* x */
|
|
|
|
0, /* y */
|
|
|
|
screen->rect.width,
|
|
|
|
screen->rect.height,
|
|
|
|
0, /* border width */
|
|
|
|
CopyFromParent, /* depth */
|
|
|
|
CopyFromParent, /* class */
|
|
|
|
CopyFromParent, /* visual */
|
|
|
|
CWEventMask|CWOverrideRedirect|CWBackPixel,
|
|
|
|
&attributes);
|
2009-06-13 16:45:32 -04:00
|
|
|
meta_stack_tracker_record_add (screen->stack_tracker,
|
|
|
|
guard_window,
|
|
|
|
create_serial);
|
|
|
|
|
|
|
|
meta_stack_tracker_record_lower (screen->stack_tracker,
|
|
|
|
guard_window,
|
|
|
|
XNextRequest (xdisplay));
|
2008-11-03 09:50:22 -05:00
|
|
|
XLowerWindow (xdisplay, guard_window);
|
|
|
|
XMapWindow (xdisplay, guard_window);
|
|
|
|
return guard_window;
|
|
|
|
}
|
|
|
|
|
2001-05-30 11:36:31 -04:00
|
|
|
MetaScreen*
|
|
|
|
meta_screen_new (MetaDisplay *display,
|
2003-11-24 12:47:48 -05:00
|
|
|
int number,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 timestamp)
|
2001-05-30 11:36:31 -04:00
|
|
|
{
|
|
|
|
MetaScreen *screen;
|
2001-05-30 23:30:58 -04:00
|
|
|
Window xroot;
|
|
|
|
Display *xdisplay;
|
2002-05-11 02:59:54 -04:00
|
|
|
XWindowAttributes attr;
|
2002-06-08 19:55:27 -04:00
|
|
|
Window new_wm_sn_owner;
|
|
|
|
Window current_wm_sn_owner;
|
|
|
|
gboolean replace_current_wm;
|
|
|
|
Atom wm_sn_atom;
|
|
|
|
char buf[128];
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 manager_timestamp;
|
2002-11-20 23:48:53 -05:00
|
|
|
gulong current_workspace;
|
2002-06-08 19:55:27 -04:00
|
|
|
|
|
|
|
replace_current_wm = meta_get_replace_current_wm ();
|
2001-05-31 02:42:58 -04:00
|
|
|
|
2001-05-30 23:30:58 -04:00
|
|
|
/* Only display->name, display->xdisplay, and display->error_traps
|
|
|
|
* can really be used in this function, since normally screens are
|
|
|
|
* created from the MetaDisplay constructor
|
|
|
|
*/
|
|
|
|
|
|
|
|
xdisplay = display->xdisplay;
|
|
|
|
|
|
|
|
meta_verbose ("Trying screen %d on display '%s'\n",
|
|
|
|
number, display->name);
|
|
|
|
|
|
|
|
xroot = RootWindow (xdisplay, number);
|
|
|
|
|
|
|
|
/* FVWM checks for None here, I don't know if this
|
|
|
|
* ever actually happens
|
|
|
|
*/
|
|
|
|
if (xroot == None)
|
|
|
|
{
|
|
|
|
meta_warning (_("Screen %d on display '%s' is invalid\n"),
|
|
|
|
number, display->name);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2002-06-08 19:55:27 -04:00
|
|
|
sprintf (buf, "WM_S%d", number);
|
|
|
|
wm_sn_atom = XInternAtom (xdisplay, buf, False);
|
|
|
|
|
|
|
|
current_wm_sn_owner = XGetSelectionOwner (xdisplay, wm_sn_atom);
|
|
|
|
|
|
|
|
if (current_wm_sn_owner != None)
|
|
|
|
{
|
|
|
|
XSetWindowAttributes attrs;
|
|
|
|
|
|
|
|
if (!replace_current_wm)
|
|
|
|
{
|
2002-08-10 13:32:29 -04:00
|
|
|
meta_warning (_("Screen %d on display \"%s\" already has a window manager; try using the --replace option to replace the current window manager.\n"),
|
2002-06-08 19:55:27 -04:00
|
|
|
number, display->name);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We want to find out when the current selection owner dies */
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_push_with_return (display);
|
2002-06-08 19:55:27 -04:00
|
|
|
attrs.event_mask = StructureNotifyMask;
|
|
|
|
XChangeWindowAttributes (xdisplay,
|
|
|
|
current_wm_sn_owner, CWEventMask, &attrs);
|
2002-10-21 17:44:35 -04:00
|
|
|
if (meta_error_trap_pop_with_return (display, FALSE) != Success)
|
2002-06-08 19:55:27 -04:00
|
|
|
current_wm_sn_owner = None; /* don't wait for it to die later on */
|
|
|
|
}
|
|
|
|
|
2007-03-31 19:34:36 -04:00
|
|
|
/* We need SelectionClear and SelectionRequest events on the new_wm_sn_owner,
|
|
|
|
* but those cannot be masked, so we only need NoEventMask.
|
|
|
|
*/
|
|
|
|
new_wm_sn_owner = meta_create_offscreen_window (xdisplay, xroot, NoEventMask);
|
2002-06-08 19:55:27 -04:00
|
|
|
|
2003-11-24 12:47:48 -05:00
|
|
|
manager_timestamp = timestamp;
|
2002-06-08 19:55:27 -04:00
|
|
|
|
|
|
|
XSetSelectionOwner (xdisplay, wm_sn_atom, new_wm_sn_owner,
|
|
|
|
manager_timestamp);
|
|
|
|
|
|
|
|
if (XGetSelectionOwner (xdisplay, wm_sn_atom) != new_wm_sn_owner)
|
|
|
|
{
|
|
|
|
meta_warning (_("Could not acquire window manager selection on screen %d display \"%s\"\n"),
|
|
|
|
number, display->name);
|
|
|
|
|
|
|
|
XDestroyWindow (xdisplay, new_wm_sn_owner);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
/* Send client message indicating that we are now the WM */
|
|
|
|
XClientMessageEvent ev;
|
|
|
|
|
|
|
|
ev.type = ClientMessage;
|
|
|
|
ev.window = xroot;
|
2008-05-02 14:49:01 -04:00
|
|
|
ev.message_type = display->atom_MANAGER;
|
2002-06-08 19:55:27 -04:00
|
|
|
ev.format = 32;
|
|
|
|
ev.data.l[0] = manager_timestamp;
|
|
|
|
ev.data.l[1] = wm_sn_atom;
|
|
|
|
|
|
|
|
XSendEvent (xdisplay, xroot, False, StructureNotifyMask, (XEvent*)&ev);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Wait for old window manager to go away */
|
|
|
|
if (current_wm_sn_owner != None)
|
|
|
|
{
|
|
|
|
XEvent event;
|
|
|
|
|
|
|
|
/* We sort of block infinitely here which is probably lame. */
|
|
|
|
|
|
|
|
meta_verbose ("Waiting for old window manager to exit\n");
|
|
|
|
do
|
|
|
|
{
|
|
|
|
XWindowEvent (xdisplay, current_wm_sn_owner,
|
|
|
|
StructureNotifyMask, &event);
|
|
|
|
}
|
|
|
|
while (event.type != DestroyNotify);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* select our root window events */
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_push_with_return (display);
|
2002-05-11 02:59:54 -04:00
|
|
|
|
|
|
|
/* We need to or with the existing event mask since
|
|
|
|
* gtk+ may be interested in other events.
|
|
|
|
*/
|
|
|
|
XGetWindowAttributes (xdisplay, xroot, &attr);
|
2001-05-30 23:30:58 -04:00
|
|
|
XSelectInput (xdisplay,
|
|
|
|
xroot,
|
|
|
|
SubstructureRedirectMask | SubstructureNotifyMask |
|
|
|
|
ColormapChangeMask | PropertyChangeMask |
|
|
|
|
LeaveWindowMask | EnterWindowMask |
|
2002-06-08 18:06:55 -04:00
|
|
|
KeyPressMask | KeyReleaseMask |
|
2002-09-28 22:50:24 -04:00
|
|
|
FocusChangeMask | StructureNotifyMask |
|
2009-05-07 17:56:27 -04:00
|
|
|
ExposureMask | attr.your_event_mask);
|
2002-10-21 17:44:35 -04:00
|
|
|
if (meta_error_trap_pop_with_return (display, FALSE) != Success)
|
2001-05-30 23:30:58 -04:00
|
|
|
{
|
2002-06-08 19:55:27 -04:00
|
|
|
meta_warning (_("Screen %d on display \"%s\" already has a window manager\n"),
|
2001-05-30 23:30:58 -04:00
|
|
|
number, display->name);
|
2002-06-08 19:55:27 -04:00
|
|
|
|
|
|
|
XDestroyWindow (xdisplay, new_wm_sn_owner);
|
|
|
|
|
2001-05-30 23:30:58 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2008-11-17 15:56:34 -05:00
|
|
|
screen = g_object_new (META_TYPE_SCREEN, NULL);
|
2002-06-22 01:11:04 -04:00
|
|
|
screen->closing = 0;
|
2002-06-08 19:55:27 -04:00
|
|
|
|
2001-05-31 02:42:58 -04:00
|
|
|
screen->display = display;
|
2001-05-30 11:36:31 -04:00
|
|
|
screen->number = number;
|
2001-06-02 21:33:27 -04:00
|
|
|
screen->screen_name = get_screen_name (display, number);
|
2001-05-30 23:30:58 -04:00
|
|
|
screen->xscreen = ScreenOfDisplay (xdisplay, number);
|
2001-06-18 02:11:53 -04:00
|
|
|
screen->xroot = xroot;
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
screen->rect.x = screen->rect.y = 0;
|
|
|
|
screen->rect.width = WidthOfScreen (screen->xscreen);
|
|
|
|
screen->rect.height = HeightOfScreen (screen->xscreen);
|
2001-07-25 23:14:45 -04:00
|
|
|
screen->current_cursor = -1; /* invalid/unset */
|
2001-09-08 23:44:42 -04:00
|
|
|
screen->default_xvisual = DefaultVisualOfScreen (screen->xscreen);
|
|
|
|
screen->default_depth = DefaultDepthOfScreen (screen->xscreen);
|
2003-01-28 10:07:43 -05:00
|
|
|
screen->flash_window = None;
|
2002-04-21 15:35:02 -04:00
|
|
|
|
2002-06-08 19:55:27 -04:00
|
|
|
screen->wm_sn_selection_window = new_wm_sn_owner;
|
|
|
|
screen->wm_sn_atom = wm_sn_atom;
|
|
|
|
screen->wm_sn_timestamp = manager_timestamp;
|
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-18 22:49:50 -05:00
|
|
|
|
|
|
|
screen->wm_cm_selection_window = meta_create_offscreen_window (xdisplay,
|
|
|
|
xroot,
|
|
|
|
NoEventMask);
|
2009-09-25 15:47:22 -04:00
|
|
|
screen->work_area_later = 0;
|
2002-05-16 00:03:36 -04:00
|
|
|
|
2002-08-04 16:17:37 -04:00
|
|
|
screen->active_workspace = NULL;
|
2002-10-16 16:12:24 -04:00
|
|
|
screen->workspaces = NULL;
|
2002-05-16 00:03:36 -04:00
|
|
|
screen->rows_of_workspaces = 1;
|
|
|
|
screen->columns_of_workspaces = -1;
|
|
|
|
screen->vertical_workspaces = FALSE;
|
2002-10-01 15:57:26 -04:00
|
|
|
screen->starting_corner = META_SCREEN_TOPLEFT;
|
2006-01-13 14:41:01 -05:00
|
|
|
screen->compositor_data = NULL;
|
2009-04-02 07:25:53 -04:00
|
|
|
screen->guard_window = None;
|
2002-09-28 22:50:24 -04:00
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
screen->monitor_infos = NULL;
|
|
|
|
screen->n_monitor_infos = 0;
|
|
|
|
screen->last_monitor_index = 0;
|
2002-10-16 16:12:24 -04:00
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
reload_monitor_infos (screen);
|
2001-07-25 23:14:45 -04:00
|
|
|
|
|
|
|
meta_screen_set_cursor (screen, META_CURSOR_DEFAULT);
|
2002-06-08 23:44:16 -04:00
|
|
|
|
2005-12-28 01:24:30 -05:00
|
|
|
/* Handle creating a no_focus_window for this screen */
|
2007-03-31 19:34:36 -04:00
|
|
|
screen->no_focus_window =
|
|
|
|
meta_create_offscreen_window (display->xdisplay,
|
|
|
|
screen->xroot,
|
|
|
|
FocusChangeMask|KeyPressMask|KeyReleaseMask);
|
2005-12-28 01:24:30 -05:00
|
|
|
XMapWindow (display->xdisplay, screen->no_focus_window);
|
|
|
|
/* Done with no_focus_window stuff */
|
2002-01-05 22:15:49 -05:00
|
|
|
|
2001-08-19 21:42:44 -04:00
|
|
|
set_wm_icon_size_hint (screen);
|
2001-06-10 15:23:28 -04:00
|
|
|
|
2001-06-09 23:17:15 -04:00
|
|
|
set_supported_hint (screen);
|
|
|
|
|
|
|
|
set_wm_check_hint (screen);
|
2002-05-16 00:03:36 -04:00
|
|
|
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
set_desktop_viewport_hint (screen);
|
|
|
|
|
|
|
|
set_desktop_geometry_hint (screen);
|
|
|
|
|
2002-05-16 00:03:36 -04:00
|
|
|
meta_screen_update_workspace_layout (screen);
|
2002-11-20 23:48:53 -05:00
|
|
|
|
|
|
|
/* Get current workspace */
|
|
|
|
current_workspace = 0;
|
|
|
|
if (meta_prop_get_cardinal (screen->display,
|
|
|
|
screen->xroot,
|
2008-05-02 14:49:01 -04:00
|
|
|
screen->display->atom__NET_CURRENT_DESKTOP,
|
2002-11-20 23:48:53 -05:00
|
|
|
¤t_workspace))
|
|
|
|
meta_verbose ("Read existing _NET_CURRENT_DESKTOP = %d\n",
|
|
|
|
(int) current_workspace);
|
|
|
|
else
|
|
|
|
meta_verbose ("No _NET_CURRENT_DESKTOP present\n");
|
2001-06-09 23:17:15 -04:00
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
/* Screens must have at least one workspace at all times,
|
|
|
|
* so create that required workspace.
|
|
|
|
*/
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 16:32:59 -04:00
|
|
|
meta_workspace_activate (meta_workspace_new (screen), timestamp);
|
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 13:27:24 -04:00
|
|
|
update_num_workspaces (screen, timestamp);
|
2002-11-20 23:48:53 -05:00
|
|
|
|
2003-02-14 02:03:46 -05:00
|
|
|
set_workspace_names (screen);
|
|
|
|
|
2002-06-30 23:20:29 -04:00
|
|
|
screen->all_keys_grabbed = FALSE;
|
2002-04-28 00:52:26 -04:00
|
|
|
screen->keys_grabbed = FALSE;
|
2001-06-06 00:47:37 -04:00
|
|
|
meta_screen_grab_keys (screen);
|
2001-06-17 23:24:25 -04:00
|
|
|
|
2001-06-18 02:11:53 -04:00
|
|
|
screen->ui = meta_ui_new (screen->display->xdisplay,
|
2001-06-17 23:24:25 -04:00
|
|
|
screen->xscreen);
|
2001-06-10 14:46:46 -04:00
|
|
|
|
2009-09-23 21:27:42 -04:00
|
|
|
screen->tab_popup = NULL;
|
2009-04-27 10:49:03 -04:00
|
|
|
screen->ws_popup = NULL;
|
2009-09-23 21:27:42 -04:00
|
|
|
|
2001-06-10 14:46:46 -04:00
|
|
|
screen->stack = meta_stack_new (screen);
|
2009-06-13 16:45:32 -04:00
|
|
|
screen->stack_tracker = meta_stack_tracker_new (screen);
|
2001-12-09 22:55:26 -05:00
|
|
|
|
|
|
|
meta_prefs_add_listener (prefs_changed_callback, screen);
|
2002-10-25 19:35:50 -04:00
|
|
|
|
|
|
|
#ifdef HAVE_STARTUP_NOTIFICATION
|
|
|
|
screen->sn_context =
|
|
|
|
sn_monitor_context_new (screen->display->sn_display,
|
|
|
|
screen->number,
|
|
|
|
meta_screen_sn_event,
|
|
|
|
screen,
|
|
|
|
NULL);
|
|
|
|
screen->startup_sequences = NULL;
|
|
|
|
screen->startup_sequence_timeout = 0;
|
|
|
|
#endif
|
2002-11-20 23:48:53 -05:00
|
|
|
|
|
|
|
/* Switch to the _NET_CURRENT_DESKTOP workspace */
|
|
|
|
{
|
|
|
|
MetaWorkspace *space;
|
|
|
|
|
|
|
|
space = meta_screen_get_workspace_by_index (screen,
|
|
|
|
current_workspace);
|
|
|
|
|
|
|
|
if (space != NULL)
|
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 16:32:59 -04:00
|
|
|
meta_workspace_activate (space, timestamp);
|
2002-11-20 23:48:53 -05:00
|
|
|
}
|
2003-11-20 21:32:05 -05:00
|
|
|
|
2001-06-02 21:33:27 -04:00
|
|
|
meta_verbose ("Added screen %d ('%s') root 0x%lx\n",
|
2003-11-20 21:32:05 -05:00
|
|
|
screen->number, screen->screen_name, screen->xroot);
|
2001-05-30 11:36:31 -04:00
|
|
|
|
|
|
|
return screen;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 13:27:24 -04:00
|
|
|
meta_screen_free (MetaScreen *screen,
|
|
|
|
guint32 timestamp)
|
2002-06-08 19:55:27 -04:00
|
|
|
{
|
|
|
|
MetaDisplay *display;
|
|
|
|
|
|
|
|
display = screen->display;
|
2002-06-22 01:11:04 -04:00
|
|
|
|
|
|
|
screen->closing += 1;
|
2002-06-08 19:55:27 -04:00
|
|
|
|
|
|
|
meta_display_grab (display);
|
|
|
|
|
2006-02-17 11:58:08 -05:00
|
|
|
if (screen->display->compositor)
|
|
|
|
{
|
|
|
|
meta_compositor_unmanage_screen (screen->display->compositor,
|
|
|
|
screen);
|
|
|
|
}
|
2003-11-20 21:32:05 -05:00
|
|
|
|
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 13:27:24 -04:00
|
|
|
meta_display_unmanage_windows_for_screen (display, screen, timestamp);
|
2002-06-08 19:55:27 -04:00
|
|
|
|
2001-12-09 22:55:26 -05:00
|
|
|
meta_prefs_remove_listener (prefs_changed_callback, screen);
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
meta_screen_ungrab_keys (screen);
|
2001-08-19 14:09:10 -04:00
|
|
|
|
2002-10-25 19:35:50 -04:00
|
|
|
#ifdef HAVE_STARTUP_NOTIFICATION
|
|
|
|
g_slist_foreach (screen->startup_sequences,
|
|
|
|
(GFunc) sn_startup_sequence_unref, NULL);
|
|
|
|
g_slist_free (screen->startup_sequences);
|
|
|
|
screen->startup_sequences = NULL;
|
|
|
|
|
|
|
|
if (screen->startup_sequence_timeout != 0)
|
|
|
|
{
|
|
|
|
g_source_remove (screen->startup_sequence_timeout);
|
|
|
|
screen->startup_sequence_timeout = 0;
|
|
|
|
}
|
|
|
|
if (screen->sn_context)
|
|
|
|
{
|
|
|
|
sn_monitor_context_unref (screen->sn_context);
|
|
|
|
screen->sn_context = NULL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2001-06-18 02:11:53 -04:00
|
|
|
meta_ui_free (screen->ui);
|
2001-06-03 17:39:57 -04:00
|
|
|
|
2001-06-10 14:46:46 -04:00
|
|
|
meta_stack_free (screen->stack);
|
2009-06-13 16:45:32 -04:00
|
|
|
meta_stack_tracker_free (screen->stack_tracker);
|
2002-01-04 17:18:10 -05:00
|
|
|
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_push_with_return (screen->display);
|
2002-01-04 17:18:10 -05:00
|
|
|
XSelectInput (screen->display->xdisplay, screen->xroot, 0);
|
2002-10-21 17:44:35 -04:00
|
|
|
if (meta_error_trap_pop_with_return (screen->display, FALSE) != Success)
|
2002-06-08 19:55:27 -04:00
|
|
|
meta_warning (_("Could not release screen %d on display \"%s\"\n"),
|
2002-01-04 17:18:10 -05:00
|
|
|
screen->number, screen->display->name);
|
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
|
|
|
|
2009-07-09 10:26:20 -04:00
|
|
|
unset_wm_check_hint (screen);
|
|
|
|
|
2002-06-08 19:55:27 -04:00
|
|
|
XDestroyWindow (screen->display->xdisplay,
|
|
|
|
screen->wm_sn_selection_window);
|
|
|
|
|
2009-09-25 15:47:22 -04:00
|
|
|
if (screen->work_area_later != 0)
|
|
|
|
g_source_remove (screen->work_area_later);
|
2003-10-12 02:25:38 -04:00
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
if (screen->monitor_infos)
|
|
|
|
g_free (screen->monitor_infos);
|
2005-07-12 15:01:38 -04:00
|
|
|
|
2001-06-02 21:33:27 -04:00
|
|
|
g_free (screen->screen_name);
|
2008-11-17 15:56:34 -05:00
|
|
|
|
|
|
|
g_object_unref (screen);
|
2002-06-08 19:55:27 -04:00
|
|
|
|
2002-08-06 00:11:23 -04:00
|
|
|
XFlush (display->xdisplay);
|
2002-06-08 19:55:27 -04:00
|
|
|
meta_display_ungrab (display);
|
2001-05-30 11:36:31 -04:00
|
|
|
}
|
|
|
|
|
2006-02-16 15:26:05 -05:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
Window xwindow;
|
|
|
|
XWindowAttributes attrs;
|
|
|
|
} WindowInfo;
|
|
|
|
|
|
|
|
static GList *
|
|
|
|
list_windows (MetaScreen *screen)
|
2001-05-31 02:42:58 -04:00
|
|
|
{
|
|
|
|
Window ignored1, ignored2;
|
|
|
|
Window *children;
|
2006-02-16 15:26:05 -05:00
|
|
|
guint n_children, i;
|
|
|
|
GList *result;
|
2001-05-31 02:42:58 -04:00
|
|
|
|
|
|
|
XQueryTree (screen->display->xdisplay,
|
|
|
|
screen->xroot,
|
|
|
|
&ignored1, &ignored2, &children, &n_children);
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2006-02-16 15:26:05 -05:00
|
|
|
result = NULL;
|
|
|
|
for (i = 0; i < n_children; ++i)
|
2001-05-31 02:42:58 -04:00
|
|
|
{
|
2006-02-16 15:26:05 -05:00
|
|
|
WindowInfo *info = g_new0 (WindowInfo, 1);
|
2001-06-10 23:24:20 -04:00
|
|
|
|
2003-11-20 21:32:05 -05:00
|
|
|
meta_error_trap_push_with_return (screen->display);
|
|
|
|
|
|
|
|
XGetWindowAttributes (screen->display->xdisplay,
|
2006-02-16 15:26:05 -05:00
|
|
|
children[i], &info->attrs);
|
|
|
|
|
|
|
|
if (meta_error_trap_pop_with_return (screen->display, TRUE))
|
|
|
|
{
|
2003-11-20 21:32:05 -05:00
|
|
|
meta_verbose ("Failed to get attributes for window 0x%lx\n",
|
|
|
|
children[i]);
|
2006-02-16 15:26:05 -05:00
|
|
|
g_free (info);
|
2003-11-20 21:32:05 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-02-16 15:26:05 -05:00
|
|
|
info->xwindow = children[i];
|
|
|
|
}
|
2003-12-25 21:42:38 -05:00
|
|
|
|
2006-02-16 15:26:05 -05:00
|
|
|
result = g_list_prepend (result, info);
|
|
|
|
}
|
2001-05-31 02:42:58 -04:00
|
|
|
|
2006-02-16 15:26:05 -05:00
|
|
|
if (children)
|
|
|
|
XFree (children);
|
|
|
|
|
|
|
|
return g_list_reverse (result);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_manage_all_windows (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
GList *windows;
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
meta_display_grab (screen->display);
|
2009-04-02 07:25:53 -04:00
|
|
|
|
|
|
|
if (screen->guard_window == None)
|
|
|
|
screen->guard_window = create_guard_window (screen->display->xdisplay,
|
|
|
|
screen);
|
|
|
|
|
2006-02-16 15:26:05 -05:00
|
|
|
windows = list_windows (screen);
|
|
|
|
|
|
|
|
meta_stack_freeze (screen->stack);
|
|
|
|
for (list = windows; list != NULL; list = list->next)
|
|
|
|
{
|
|
|
|
WindowInfo *info = list->data;
|
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-18 22:49:50 -05:00
|
|
|
MetaWindow *window;
|
|
|
|
|
|
|
|
window = meta_window_new_with_attrs (screen->display, info->xwindow, TRUE,
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
|
|
|
META_COMP_EFFECT_NONE,
|
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-18 22:49:50 -05:00
|
|
|
&info->attrs);
|
2001-05-31 02:42:58 -04:00
|
|
|
}
|
2001-06-10 23:24:20 -04:00
|
|
|
meta_stack_thaw (screen->stack);
|
2001-05-31 02:42:58 -04:00
|
|
|
|
2006-02-16 15:26:05 -05:00
|
|
|
g_list_foreach (windows, (GFunc)g_free, NULL);
|
|
|
|
g_list_free (windows);
|
|
|
|
|
2001-05-31 02:42:58 -04:00
|
|
|
meta_display_ungrab (screen->display);
|
2006-02-16 15:26:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_composite_all_windows (MetaScreen *screen)
|
|
|
|
{
|
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-18 22:49:50 -05:00
|
|
|
MetaDisplay *display;
|
2008-11-23 14:28:40 -05:00
|
|
|
GSList *windows, *tmp;
|
2006-02-16 15:26:05 -05: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-18 22:49:50 -05:00
|
|
|
display = screen->display;
|
|
|
|
if (!display->compositor)
|
2006-02-16 15:26:05 -05:00
|
|
|
return;
|
2006-03-03 10:53:10 -05:00
|
|
|
|
2009-06-15 15:32:23 -04:00
|
|
|
windows = meta_display_list_windows (display,
|
|
|
|
META_LIST_INCLUDE_OVERRIDE_REDIRECT);
|
2008-11-23 14:28:40 -05:00
|
|
|
for (tmp = windows; tmp != NULL; tmp = tmp->next)
|
|
|
|
meta_compositor_add_window (display->compositor, tmp->data);
|
|
|
|
g_slist_free (windows);
|
|
|
|
|
2009-06-14 08:04:28 -04:00
|
|
|
/* initialize the compositor's view of the stacking order */
|
|
|
|
meta_stack_tracker_sync_stack (screen->stack_tracker);
|
2001-05-31 02:42:58 -04:00
|
|
|
}
|
2001-05-31 23:00:01 -04:00
|
|
|
|
2008-11-17 16:34:28 -05:00
|
|
|
/**
|
|
|
|
* meta_screen_for_x_screen:
|
|
|
|
* @xscreen: an X screen structure.
|
|
|
|
*
|
|
|
|
* Gets the #MetaScreen corresponding to an X screen structure.
|
|
|
|
*
|
|
|
|
* Return value: (transfer none): the #MetaScreen for the X screen
|
|
|
|
* %NULL if Metacity is not managing the screen.
|
|
|
|
*/
|
2001-05-31 23:00:01 -04:00
|
|
|
MetaScreen*
|
|
|
|
meta_screen_for_x_screen (Screen *xscreen)
|
|
|
|
{
|
|
|
|
MetaDisplay *display;
|
|
|
|
|
|
|
|
display = meta_display_for_x_display (DisplayOfScreen (xscreen));
|
|
|
|
|
|
|
|
if (display == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return meta_display_screen_for_x_screen (display, xscreen);
|
|
|
|
}
|
2001-06-02 21:33:27 -04:00
|
|
|
|
2001-12-09 22:55:26 -05:00
|
|
|
static void
|
|
|
|
prefs_changed_callback (MetaPreference pref,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
MetaScreen *screen = data;
|
|
|
|
|
|
|
|
if (pref == META_PREF_NUM_WORKSPACES)
|
|
|
|
{
|
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 13:27:24 -04:00
|
|
|
/* GConf doesn't provide timestamps, but luckily update_num_workspaces
|
|
|
|
* often doesn't need it...
|
|
|
|
*/
|
|
|
|
guint32 timestamp =
|
|
|
|
meta_display_get_current_time_roundtrip (screen->display);
|
|
|
|
update_num_workspaces (screen, timestamp);
|
2001-12-09 22:55:26 -05:00
|
|
|
}
|
2001-12-10 02:48:21 -05:00
|
|
|
else if (pref == META_PREF_FOCUS_MODE)
|
|
|
|
{
|
|
|
|
update_focus_mode (screen);
|
|
|
|
}
|
2002-11-03 14:06:39 -05:00
|
|
|
else if (pref == META_PREF_WORKSPACE_NAMES)
|
|
|
|
{
|
2003-02-14 02:03:46 -05:00
|
|
|
set_workspace_names (screen);
|
2002-11-03 14:06:39 -05:00
|
|
|
}
|
2001-12-09 22:55:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-02 21:33:27 -04:00
|
|
|
static char*
|
|
|
|
get_screen_name (MetaDisplay *display,
|
|
|
|
int number)
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
char *dname;
|
|
|
|
char *scr;
|
|
|
|
|
|
|
|
/* DisplayString gives us a sort of canonical display,
|
|
|
|
* vs. the user-entered name from XDisplayName()
|
|
|
|
*/
|
|
|
|
dname = g_strdup (DisplayString (display->xdisplay));
|
|
|
|
|
|
|
|
/* Change display name to specify this screen.
|
|
|
|
*/
|
|
|
|
p = strrchr (dname, ':');
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
p = strchr (p, '.');
|
|
|
|
if (p)
|
|
|
|
*p = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
scr = g_strdup_printf ("%s.%d", dname, number);
|
|
|
|
|
|
|
|
g_free (dname);
|
|
|
|
|
|
|
|
return scr;
|
|
|
|
}
|
2001-06-03 14:33:59 -04:00
|
|
|
|
|
|
|
static gint
|
|
|
|
ptrcmp (gconstpointer a, gconstpointer b)
|
|
|
|
{
|
|
|
|
if (a < b)
|
|
|
|
return -1;
|
|
|
|
else if (a > b)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
listify_func (gpointer key, gpointer value, gpointer data)
|
|
|
|
{
|
|
|
|
GSList **listp;
|
|
|
|
|
|
|
|
listp = data;
|
|
|
|
|
|
|
|
*listp = g_slist_prepend (*listp, value);
|
|
|
|
}
|
|
|
|
|
2009-06-15 17:15:38 -04:00
|
|
|
/**
|
|
|
|
* meta_screen_foreach_window:
|
|
|
|
* @screen: a #MetaScreen
|
|
|
|
* @func: function to call for each window
|
|
|
|
* @data: user data to pass to @func
|
|
|
|
*
|
|
|
|
* Calls the specified function for each window on the screen,
|
|
|
|
* ignoring override-redirect windows.
|
|
|
|
*/
|
2001-06-03 14:33:59 -04:00
|
|
|
void
|
|
|
|
meta_screen_foreach_window (MetaScreen *screen,
|
|
|
|
MetaScreenWindowFunc func,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GSList *winlist;
|
|
|
|
GSList *tmp;
|
|
|
|
|
|
|
|
/* If we end up doing this often, just keeping a list
|
|
|
|
* of windows might be sensible.
|
|
|
|
*/
|
|
|
|
|
|
|
|
winlist = NULL;
|
|
|
|
g_hash_table_foreach (screen->display->window_ids,
|
|
|
|
listify_func,
|
|
|
|
&winlist);
|
|
|
|
|
|
|
|
winlist = g_slist_sort (winlist, ptrcmp);
|
|
|
|
|
|
|
|
tmp = winlist;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
/* If the next node doesn't contain this window
|
|
|
|
* a second time, delete the window.
|
|
|
|
*/
|
|
|
|
if (tmp->next == NULL ||
|
|
|
|
(tmp->next && tmp->next->data != tmp->data))
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
|
|
|
|
2009-06-15 17:15:38 -04:00
|
|
|
if (window->screen == screen && !window->override_redirect)
|
2001-06-03 14:33:59 -04:00
|
|
|
(* func) (screen, window, data);
|
|
|
|
}
|
|
|
|
|
2001-12-10 02:48:21 -05:00
|
|
|
tmp = tmp->next;
|
2001-06-03 14:33:59 -04:00
|
|
|
}
|
|
|
|
g_slist_free (winlist);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
queue_draw (MetaScreen *screen, MetaWindow *window, gpointer data)
|
|
|
|
{
|
|
|
|
if (window->frame)
|
|
|
|
meta_frame_queue_draw (window->frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_queue_frame_redraws (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
meta_screen_foreach_window (screen, queue_draw, NULL);
|
|
|
|
}
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2001-06-19 23:01:26 -04:00
|
|
|
static void
|
|
|
|
queue_resize (MetaScreen *screen, MetaWindow *window, gpointer data)
|
|
|
|
{
|
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
|
|
|
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
|
2001-06-19 23:01:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_queue_window_resizes (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
meta_screen_foreach_window (screen, queue_resize, NULL);
|
|
|
|
}
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2001-06-09 01:14:43 -04:00
|
|
|
int
|
|
|
|
meta_screen_get_n_workspaces (MetaScreen *screen)
|
2002-10-16 16:12:24 -04:00
|
|
|
{
|
|
|
|
return g_list_length (screen->workspaces);
|
|
|
|
}
|
|
|
|
|
2008-11-17 16:34:28 -05:00
|
|
|
/**
|
|
|
|
* meta_screen_get_workspace_by_index:
|
|
|
|
* @screen: a #MetaScreen
|
|
|
|
* @index: index of one of the screen's workspaces
|
|
|
|
*
|
|
|
|
* Gets the workspace object for one of a screen's workspaces given the workspace
|
|
|
|
* index. It's valid to call this function with an out-of-range index and it
|
|
|
|
* will robustly return %NULL.
|
|
|
|
*
|
|
|
|
* Return value: (transfer none): the workspace object with specified index, or %NULL
|
|
|
|
* if the index is out of range.
|
|
|
|
*/
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaWorkspace*
|
|
|
|
meta_screen_get_workspace_by_index (MetaScreen *screen,
|
|
|
|
int idx)
|
2001-06-09 01:14:43 -04:00
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
int i;
|
|
|
|
|
2002-10-16 16:12:24 -04:00
|
|
|
/* should be robust, idx is maybe from an app */
|
|
|
|
if (idx < 0)
|
|
|
|
return NULL;
|
|
|
|
|
2001-06-09 01:14:43 -04:00
|
|
|
i = 0;
|
2002-10-16 16:12:24 -04:00
|
|
|
tmp = screen->workspaces;
|
2001-06-09 01:14:43 -04:00
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWorkspace *w = tmp->data;
|
|
|
|
|
2002-10-16 16:12:24 -04:00
|
|
|
if (i == idx)
|
|
|
|
return w;
|
|
|
|
|
|
|
|
++i;
|
2001-06-09 01:14:43 -04:00
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
2002-10-16 16:12:24 -04:00
|
|
|
return NULL;
|
2001-12-09 22:55:26 -05:00
|
|
|
}
|
2001-06-09 01:14:43 -04:00
|
|
|
|
2002-10-21 17:44:35 -04:00
|
|
|
static void
|
2002-08-13 20:08:30 -04:00
|
|
|
set_number_of_spaces_hint (MetaScreen *screen,
|
|
|
|
int n_spaces)
|
|
|
|
{
|
|
|
|
unsigned long data[1];
|
|
|
|
|
|
|
|
if (screen->closing > 0)
|
2002-10-21 17:44:35 -04:00
|
|
|
return;
|
2002-08-13 20:08:30 -04:00
|
|
|
|
|
|
|
data[0] = n_spaces;
|
|
|
|
|
2006-01-20 17:03:56 -05:00
|
|
|
meta_verbose ("Setting _NET_NUMBER_OF_DESKTOPS to %lu\n", data[0]);
|
2002-08-13 20:08:30 -04:00
|
|
|
|
|
|
|
meta_error_trap_push (screen->display);
|
|
|
|
XChangeProperty (screen->display->xdisplay, screen->xroot,
|
2008-05-02 14:49:01 -04:00
|
|
|
screen->display->atom__NET_NUMBER_OF_DESKTOPS,
|
2002-08-13 20:08:30 -04:00
|
|
|
XA_CARDINAL,
|
|
|
|
32, PropModeReplace, (guchar*) data, 1);
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_pop (screen->display, FALSE);
|
2002-08-13 20:08:30 -04:00
|
|
|
}
|
|
|
|
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
static void
|
|
|
|
set_desktop_geometry_hint (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
unsigned long data[2];
|
|
|
|
|
|
|
|
if (screen->closing > 0)
|
|
|
|
return;
|
|
|
|
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
data[0] = screen->rect.width;
|
|
|
|
data[1] = screen->rect.height;
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
|
2006-01-20 17:03:56 -05:00
|
|
|
meta_verbose ("Setting _NET_DESKTOP_GEOMETRY to %lu, %lu\n", data[0], data[1]);
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
|
|
|
|
meta_error_trap_push (screen->display);
|
|
|
|
XChangeProperty (screen->display->xdisplay, screen->xroot,
|
2008-05-02 14:49:01 -04:00
|
|
|
screen->display->atom__NET_DESKTOP_GEOMETRY,
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
XA_CARDINAL,
|
|
|
|
32, PropModeReplace, (guchar*) data, 2);
|
|
|
|
meta_error_trap_pop (screen->display, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_desktop_viewport_hint (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
unsigned long data[2];
|
|
|
|
|
|
|
|
if (screen->closing > 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/*
|
Comprehensively rename to Mutter
Code:
All references in the code not related to themes, keybindings, or
GConf were changed from 'metacity' to 'mutter'. This includes, among other
things, strings, comments, the atoms used in the message protocol, and
the envvars used for debugging. The GConf schema file was reduced to
the 3 settings new to mutter.
The overall version was brought up to 2.27 to match current gnome.
Structure:
All files named '*metacity*' were renamed '*mutter*' with appropriate
changes in the automake system. Files removed are
doc/creating_themes, src/themes, doc/metacity-theme.dtd,
metacity.doap. These files will eventually end up in an external
gnome-wm-data module.
Installation location:
On the filesystem the mutter-plugindir was change from
$(libdir)/metacity/plugins/clutter to just $(libdir)/mutter/plugins.
The mutter-plugins.pc.in reflects these changes.
Note:
mutter.desktop.in and mutter-wm.desktop both continue to have
X-GNOME-WMSettingsModule=metacity set. This allows
gnome-control-center to continue using libmetacity.so for
configuration. This is fine since most the general keybindings and wm
settings are being read from /apps/metacity/* in gconf.
2009-06-10 06:29:20 -04:00
|
|
|
* Mutter does not implement viewports, so this is a fixed 0,0
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
*/
|
|
|
|
data[0] = 0;
|
|
|
|
data[1] = 0;
|
|
|
|
|
|
|
|
meta_verbose ("Setting _NET_DESKTOP_VIEWPORT to 0, 0\n");
|
|
|
|
|
|
|
|
meta_error_trap_push (screen->display);
|
|
|
|
XChangeProperty (screen->display->xdisplay, screen->xroot,
|
2008-05-02 14:49:01 -04:00
|
|
|
screen->display->atom__NET_DESKTOP_VIEWPORT,
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
XA_CARDINAL,
|
|
|
|
32, PropModeReplace, (guchar*) data, 2);
|
|
|
|
meta_error_trap_pop (screen->display, FALSE);
|
|
|
|
}
|
|
|
|
|
2008-10-24 06:03:43 -04:00
|
|
|
void
|
|
|
|
meta_screen_remove_workspace (MetaScreen *screen, MetaWorkspace *workspace,
|
|
|
|
guint32 timestamp)
|
|
|
|
{
|
|
|
|
GList *l;
|
|
|
|
MetaWorkspace *neighbour = NULL;
|
2009-01-09 10:04:53 -05:00
|
|
|
GList *next = NULL;
|
2009-07-02 11:19:02 -04:00
|
|
|
int index;
|
2008-10-24 06:03:43 -04:00
|
|
|
|
|
|
|
l = screen->workspaces;
|
|
|
|
while (l)
|
|
|
|
{
|
|
|
|
MetaWorkspace *w = l->data;
|
|
|
|
|
|
|
|
if (w == workspace)
|
|
|
|
{
|
2009-01-09 10:04:53 -05:00
|
|
|
if (l->next)
|
|
|
|
next = l->next;
|
|
|
|
|
2008-10-24 06:03:43 -04:00
|
|
|
if (l->prev)
|
|
|
|
neighbour = l->prev->data;
|
|
|
|
else if (l->next)
|
|
|
|
neighbour = l->next->data;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Cannot remove the only workspace! */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
l = l->next;
|
|
|
|
}
|
|
|
|
|
2009-01-20 07:48:59 -05:00
|
|
|
if (!neighbour)
|
|
|
|
return;
|
|
|
|
|
2008-10-24 06:03:43 -04:00
|
|
|
meta_workspace_relocate_windows (workspace, neighbour);
|
|
|
|
|
|
|
|
if (workspace == screen->active_workspace)
|
|
|
|
meta_workspace_activate (neighbour, timestamp);
|
|
|
|
|
2009-07-02 11:19:02 -04:00
|
|
|
/* To emit the signal after removing the workspace */
|
|
|
|
index = meta_workspace_index (workspace);
|
|
|
|
|
2008-10-24 06:03:43 -04:00
|
|
|
/* This also removes the workspace from the screens list */
|
2008-11-17 15:56:34 -05:00
|
|
|
meta_workspace_remove (workspace);
|
2008-10-24 06:03:43 -04:00
|
|
|
|
|
|
|
set_number_of_spaces_hint (screen, g_list_length (screen->workspaces));
|
|
|
|
|
2009-01-09 10:04:53 -05:00
|
|
|
l = next;
|
|
|
|
while (l)
|
|
|
|
{
|
|
|
|
MetaWorkspace *w = l->data;
|
|
|
|
|
|
|
|
meta_workspace_update_window_hints (w);
|
|
|
|
|
|
|
|
l = l->next;
|
|
|
|
}
|
|
|
|
|
2008-10-24 06:03:43 -04:00
|
|
|
meta_screen_queue_workarea_recalc (screen);
|
2008-11-17 17:22:28 -05:00
|
|
|
|
2009-07-02 11:19:02 -04:00
|
|
|
g_signal_emit (screen, screen_signals[WORKSPACE_REMOVED], 0, index);
|
2008-11-17 17:22:28 -05:00
|
|
|
g_object_notify (G_OBJECT (screen), "n-workspaces");
|
2008-10-24 06:03:43 -04:00
|
|
|
}
|
|
|
|
|
2008-11-17 16:34:28 -05:00
|
|
|
/**
|
|
|
|
* meta_screen_append_new_workspace:
|
|
|
|
* @screen: a #MetaScreen
|
|
|
|
* @activate: %TRUE if the workspace should be switched to after creation
|
|
|
|
* @timestamp: if switching to a new workspace, timestamp to be used when
|
|
|
|
* focusing a window on the new workspace. (Doesn't hurt to pass a valid
|
|
|
|
* timestamp when available even if not switching workspaces.)
|
|
|
|
*
|
|
|
|
* Append a new workspace to the screen and (optionally) switch to that
|
|
|
|
* screen.
|
|
|
|
*
|
|
|
|
* Return value: (transfer none): the newly appended workspace.
|
|
|
|
*/
|
2008-10-24 06:11:28 -04:00
|
|
|
MetaWorkspace *
|
|
|
|
meta_screen_append_new_workspace (MetaScreen *screen, gboolean activate,
|
|
|
|
guint32 timestamp)
|
|
|
|
{
|
|
|
|
MetaWorkspace *w;
|
|
|
|
|
|
|
|
/* This also adds the workspace to the screen list */
|
|
|
|
w = meta_workspace_new (screen);
|
|
|
|
|
|
|
|
if (!w)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (activate)
|
|
|
|
meta_workspace_activate (w, timestamp);
|
|
|
|
|
|
|
|
set_number_of_spaces_hint (screen, g_list_length (screen->workspaces));
|
|
|
|
|
|
|
|
meta_screen_queue_workarea_recalc (screen);
|
|
|
|
|
2009-07-02 11:19:02 -04:00
|
|
|
g_signal_emit (screen, screen_signals[WORKSPACE_ADDED],
|
|
|
|
0, meta_workspace_index (w));
|
2008-11-17 17:22:28 -05:00
|
|
|
g_object_notify (G_OBJECT (screen), "n-workspaces");
|
|
|
|
|
2008-10-24 06:11:28 -04:00
|
|
|
return w;
|
|
|
|
}
|
|
|
|
|
2008-10-24 06:03:43 -04:00
|
|
|
|
2001-12-09 22:55:26 -05:00
|
|
|
static void
|
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 13:27:24 -04:00
|
|
|
update_num_workspaces (MetaScreen *screen,
|
|
|
|
guint32 timestamp)
|
2001-12-09 22:55:26 -05:00
|
|
|
{
|
|
|
|
int new_num;
|
|
|
|
GList *tmp;
|
|
|
|
int i;
|
|
|
|
GList *extras;
|
|
|
|
MetaWorkspace *last_remaining;
|
|
|
|
gboolean need_change_space;
|
|
|
|
|
|
|
|
new_num = meta_prefs_get_num_workspaces ();
|
|
|
|
|
|
|
|
g_assert (new_num > 0);
|
|
|
|
|
|
|
|
last_remaining = NULL;
|
|
|
|
extras = NULL;
|
|
|
|
i = 0;
|
2002-10-16 16:12:24 -04:00
|
|
|
tmp = screen->workspaces;
|
2001-12-09 22:55:26 -05:00
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWorkspace *w = tmp->data;
|
|
|
|
|
2003-01-07 23:23:18 -05:00
|
|
|
if (i >= new_num)
|
2002-10-16 16:12:24 -04:00
|
|
|
extras = g_list_prepend (extras, w);
|
|
|
|
else
|
|
|
|
last_remaining = w;
|
|
|
|
|
|
|
|
++i;
|
2001-12-09 22:55:26 -05:00
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert (last_remaining);
|
|
|
|
|
|
|
|
/* Get rid of the extra workspaces by moving all their windows
|
|
|
|
* to last_remaining, then activating last_remaining if
|
|
|
|
* one of the removed workspaces was active. This will be a bit
|
|
|
|
* wacky if the config tool for changing number of workspaces
|
|
|
|
* is on a removed workspace ;-)
|
|
|
|
*/
|
|
|
|
need_change_space = FALSE;
|
|
|
|
tmp = extras;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWorkspace *w = tmp->data;
|
|
|
|
|
|
|
|
meta_workspace_relocate_windows (w, last_remaining);
|
|
|
|
|
|
|
|
if (w == screen->active_workspace)
|
|
|
|
need_change_space = TRUE;
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (need_change_space)
|
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com>
Partial audit to fix timestamp usage. One step towards fixing
#355180; see important comments in that bug.
* src/core.[ch] (meta_core_unshade, meta_core_shade):
* src/delete.c (meta_window_present_delete_dialog,
delete_ping_timeout_func):
* src/display.[ch] (meta_display_open, meta_display_close,
event_callback, meta_display_begin_grab_op,
process_selection_clear, meta_display_unmanage_screen,
meta_display_unmanage_windows_for_screen):
* src/frames.c (meta_frames_button_press_event):
* src/keybindings.c (handle_toggle_shade):
* src/main.c (main):
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
meta_screen_free, prefs_changed_callback):
* src/window.[ch] (meta_window_free, finish_minimize,
implement_showing, meta_window_show, meta_window_maximize,
meta_window_make_fullscreen_internal,
meta_window_unmake_fullscreen, meta_window_shade,
meta_window_unshade, window_activate, send_sync_request,
meta_window_client_message, menu_callback,
meta_window_update_keyboard_resize):
Remove usage of CurrentTime, meta_display_get_current_time() and
meta_display_get_current_time_roundtrip() where possible, or
document why it isn't possible, or at very least add a FIXME with
some explanation of my laziness and what needs to be done.
2006-09-18 13:27:24 -04:00
|
|
|
meta_workspace_activate (last_remaining, timestamp);
|
2001-12-09 22:55:26 -05:00
|
|
|
|
|
|
|
/* Should now be safe to free the workspaces */
|
|
|
|
tmp = extras;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWorkspace *w = tmp->data;
|
|
|
|
|
|
|
|
g_assert (w->windows == NULL);
|
2008-11-17 15:56:34 -05:00
|
|
|
meta_workspace_remove (w);
|
2001-12-09 22:55:26 -05:00
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (extras);
|
|
|
|
|
|
|
|
while (i < new_num)
|
|
|
|
{
|
|
|
|
meta_workspace_new (screen);
|
|
|
|
++i;
|
|
|
|
}
|
2002-06-24 21:12:37 -04:00
|
|
|
|
2002-08-13 20:08:30 -04:00
|
|
|
set_number_of_spaces_hint (screen, new_num);
|
|
|
|
|
2002-06-24 21:12:37 -04:00
|
|
|
meta_screen_queue_workarea_recalc (screen);
|
2008-11-17 17:22:28 -05:00
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (screen), "n-workspaces");
|
2001-06-09 01:14:43 -04:00
|
|
|
}
|
2001-07-25 23:14:45 -04:00
|
|
|
|
2001-12-10 02:48:21 -05:00
|
|
|
static void
|
|
|
|
update_focus_mode (MetaScreen *screen)
|
|
|
|
{
|
2001-12-10 23:03:58 -05:00
|
|
|
/* nothing to do anymore */ ;
|
2001-12-10 02:48:21 -05:00
|
|
|
}
|
|
|
|
|
2001-07-25 23:14:45 -04:00
|
|
|
void
|
|
|
|
meta_screen_set_cursor (MetaScreen *screen,
|
|
|
|
MetaCursor cursor)
|
|
|
|
{
|
|
|
|
Cursor xcursor;
|
|
|
|
|
|
|
|
if (cursor == screen->current_cursor)
|
|
|
|
return;
|
|
|
|
|
|
|
|
screen->current_cursor = cursor;
|
|
|
|
|
|
|
|
xcursor = meta_display_create_x_cursor (screen->display, cursor);
|
|
|
|
XDefineCursor (screen->display->xdisplay, screen->xroot, xcursor);
|
2004-08-07 12:33:11 -04:00
|
|
|
XFlush (screen->display->xdisplay);
|
2001-07-25 23:14:45 -04:00
|
|
|
XFreeCursor (screen->display->xdisplay, xcursor);
|
|
|
|
}
|
2001-08-19 14:09:10 -04:00
|
|
|
|
2005-07-11 09:25:08 -04:00
|
|
|
void
|
|
|
|
meta_screen_update_cursor (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
Cursor xcursor;
|
|
|
|
|
|
|
|
xcursor = meta_display_create_x_cursor (screen->display,
|
|
|
|
screen->current_cursor);
|
|
|
|
XDefineCursor (screen->display->xdisplay, screen->xroot, xcursor);
|
|
|
|
XFlush (screen->display->xdisplay);
|
|
|
|
XFreeCursor (screen->display->xdisplay, xcursor);
|
|
|
|
}
|
|
|
|
|
2001-08-19 14:09:10 -04:00
|
|
|
void
|
2009-04-28 09:32:18 -04:00
|
|
|
meta_screen_tab_popup_create (MetaScreen *screen,
|
2006-01-10 00:05:40 -05:00
|
|
|
MetaTabList list_type,
|
2009-04-27 11:19:08 -04:00
|
|
|
MetaTabShowType show_type,
|
|
|
|
MetaWindow *initial_selection)
|
2001-08-19 14:09:10 -04:00
|
|
|
{
|
2009-09-23 21:27:42 -04:00
|
|
|
MetaTabEntry *entries;
|
2003-03-14 21:16:21 -05:00
|
|
|
GList *tab_list;
|
|
|
|
GList *tmp;
|
2009-09-23 21:27:42 -04:00
|
|
|
int len;
|
|
|
|
int i;
|
2002-05-11 02:59:54 -04:00
|
|
|
|
2009-09-23 21:27:42 -04:00
|
|
|
if (screen->tab_popup)
|
|
|
|
return;
|
2001-08-19 14:09:10 -04:00
|
|
|
|
2002-03-11 23:34:17 -05:00
|
|
|
tab_list = meta_display_get_tab_list (screen->display,
|
2006-01-10 00:05:40 -05:00
|
|
|
list_type,
|
2002-03-11 23:34:17 -05:00
|
|
|
screen,
|
|
|
|
screen->active_workspace);
|
2009-09-23 21:27:42 -04:00
|
|
|
|
|
|
|
len = g_list_length (tab_list);
|
|
|
|
|
|
|
|
entries = g_new (MetaTabEntry, len + 1);
|
|
|
|
entries[len].key = NULL;
|
|
|
|
entries[len].title = NULL;
|
|
|
|
entries[len].icon = NULL;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
tmp = tab_list;
|
|
|
|
while (i < len)
|
|
|
|
{
|
|
|
|
MetaWindow *window;
|
|
|
|
MetaRectangle r;
|
|
|
|
|
|
|
|
window = tmp->data;
|
|
|
|
|
|
|
|
entries[i].key = (MetaTabEntryKey) window;
|
|
|
|
entries[i].title = window->title;
|
|
|
|
entries[i].icon = g_object_ref (window->icon);
|
|
|
|
entries[i].blank = FALSE;
|
|
|
|
entries[i].hidden = !meta_window_showing_on_its_workspace (window);
|
|
|
|
entries[i].demands_attention = window->wm_state_demands_attention;
|
|
|
|
|
|
|
|
if (show_type == META_TAB_SHOW_INSTANTLY ||
|
|
|
|
!entries[i].hidden ||
|
|
|
|
!meta_window_get_icon_geometry (window, &r))
|
|
|
|
meta_window_get_outer_rect (window, &r);
|
|
|
|
|
|
|
|
entries[i].rect = r;
|
|
|
|
|
|
|
|
/* Find inside of highlight rectangle to be used when window is
|
|
|
|
* outlined for tabbing. This should be the size of the
|
|
|
|
* east/west frame, and the size of the south frame, on those
|
|
|
|
* sides. On the top it should be the size of the south frame
|
|
|
|
* edge.
|
|
|
|
*/
|
|
|
|
#define OUTLINE_WIDTH 5
|
|
|
|
/* Top side */
|
|
|
|
if (!entries[i].hidden &&
|
|
|
|
window->frame && window->frame->bottom_height > 0 &&
|
|
|
|
window->frame->child_y >= window->frame->bottom_height)
|
|
|
|
entries[i].inner_rect.y = window->frame->bottom_height;
|
|
|
|
else
|
|
|
|
entries[i].inner_rect.y = OUTLINE_WIDTH;
|
|
|
|
|
|
|
|
/* Bottom side */
|
|
|
|
if (!entries[i].hidden &&
|
|
|
|
window->frame && window->frame->bottom_height != 0)
|
|
|
|
entries[i].inner_rect.height = r.height
|
|
|
|
- entries[i].inner_rect.y - window->frame->bottom_height;
|
|
|
|
else
|
|
|
|
entries[i].inner_rect.height = r.height
|
|
|
|
- entries[i].inner_rect.y - OUTLINE_WIDTH;
|
|
|
|
|
|
|
|
/* Left side */
|
|
|
|
if (!entries[i].hidden && window->frame && window->frame->child_x != 0)
|
|
|
|
entries[i].inner_rect.x = window->frame->child_x;
|
|
|
|
else
|
|
|
|
entries[i].inner_rect.x = OUTLINE_WIDTH;
|
|
|
|
|
|
|
|
/* Right side */
|
|
|
|
if (!entries[i].hidden &&
|
|
|
|
window->frame && window->frame->right_width != 0)
|
|
|
|
entries[i].inner_rect.width = r.width
|
|
|
|
- entries[i].inner_rect.x - window->frame->right_width;
|
|
|
|
else
|
|
|
|
entries[i].inner_rect.width = r.width
|
|
|
|
- entries[i].inner_rect.x - OUTLINE_WIDTH;
|
|
|
|
|
|
|
|
++i;
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!meta_prefs_get_no_tab_popup ())
|
|
|
|
screen->tab_popup = meta_ui_tab_popup_new (entries,
|
|
|
|
screen->number,
|
|
|
|
len,
|
|
|
|
5, /* FIXME */
|
|
|
|
TRUE);
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
g_object_unref (entries[i].icon);
|
|
|
|
|
|
|
|
g_free (entries);
|
|
|
|
|
|
|
|
g_list_free (tab_list);
|
|
|
|
|
|
|
|
meta_ui_tab_popup_select (screen->tab_popup,
|
|
|
|
(MetaTabEntryKey) initial_selection);
|
|
|
|
|
|
|
|
if (show_type != META_TAB_SHOW_INSTANTLY)
|
|
|
|
meta_ui_tab_popup_set_showing (screen->tab_popup, TRUE);
|
2001-08-19 14:09:10 -04:00
|
|
|
}
|
2002-01-03 18:28:19 -05:00
|
|
|
|
2009-04-27 10:01:30 -04:00
|
|
|
void
|
2009-04-27 11:19:08 -04:00
|
|
|
meta_screen_tab_popup_forward (MetaScreen *screen)
|
|
|
|
{
|
2009-09-23 21:27:42 -04:00
|
|
|
g_return_if_fail (screen->tab_popup != NULL);
|
2009-04-27 11:19:08 -04:00
|
|
|
|
2009-09-23 21:27:42 -04:00
|
|
|
meta_ui_tab_popup_forward (screen->tab_popup);
|
2009-04-27 11:19:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_tab_popup_backward (MetaScreen *screen)
|
|
|
|
{
|
2009-09-23 21:27:42 -04:00
|
|
|
g_return_if_fail (screen->tab_popup != NULL);
|
2009-04-27 11:19:08 -04:00
|
|
|
|
2009-09-23 21:27:42 -04:00
|
|
|
meta_ui_tab_popup_backward (screen->tab_popup);
|
2009-04-27 11:19:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
MetaWindow *
|
|
|
|
meta_screen_tab_popup_get_selected (MetaScreen *screen)
|
|
|
|
{
|
2009-09-23 21:27:42 -04:00
|
|
|
g_return_val_if_fail (screen->tab_popup != NULL, NULL);
|
2009-04-27 11:19:08 -04:00
|
|
|
|
2009-09-23 21:27:42 -04:00
|
|
|
return (MetaWindow *) meta_ui_tab_popup_get_selected (screen->tab_popup);
|
2009-04-27 11:19:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_tab_popup_destroy (MetaScreen *screen)
|
2009-04-27 10:01:30 -04:00
|
|
|
{
|
2009-09-23 21:27:42 -04:00
|
|
|
if (screen->tab_popup)
|
|
|
|
{
|
|
|
|
meta_ui_tab_popup_free (screen->tab_popup);
|
|
|
|
screen->tab_popup = NULL;
|
|
|
|
}
|
2009-04-27 10:01:30 -04:00
|
|
|
}
|
|
|
|
|
2002-06-22 01:11:04 -04:00
|
|
|
void
|
2009-04-28 09:32:18 -04:00
|
|
|
meta_screen_workspace_popup_create (MetaScreen *screen,
|
2009-04-27 11:19:08 -04:00
|
|
|
MetaWorkspace *initial_selection)
|
2002-06-22 01:11:04 -04:00
|
|
|
{
|
|
|
|
MetaTabEntry *entries;
|
2003-01-05 13:36:01 -05:00
|
|
|
int len;
|
2002-06-22 01:11:04 -04:00
|
|
|
int i;
|
2003-01-05 13:36:01 -05:00
|
|
|
MetaWorkspaceLayout layout;
|
|
|
|
int n_workspaces;
|
|
|
|
int current_workspace;
|
2009-09-23 21:27:42 -04:00
|
|
|
|
|
|
|
if (screen->ws_popup || meta_prefs_get_no_tab_popup ())
|
|
|
|
return;
|
2002-06-22 01:11:04 -04:00
|
|
|
|
2003-01-05 13:36:01 -05:00
|
|
|
current_workspace = meta_workspace_index (screen->active_workspace);
|
|
|
|
n_workspaces = meta_screen_get_n_workspaces (screen);
|
2002-06-22 01:11:04 -04:00
|
|
|
|
2003-01-05 13:36:01 -05:00
|
|
|
meta_screen_calc_workspace_layout (screen, n_workspaces,
|
|
|
|
current_workspace, &layout);
|
|
|
|
|
|
|
|
len = layout.grid_area;
|
|
|
|
|
2002-06-22 01:11:04 -04:00
|
|
|
entries = g_new (MetaTabEntry, len + 1);
|
|
|
|
entries[len].key = NULL;
|
|
|
|
entries[len].title = NULL;
|
|
|
|
entries[len].icon = NULL;
|
|
|
|
|
2003-01-05 13:36:01 -05:00
|
|
|
i = 0;
|
|
|
|
while (i < len)
|
2002-06-22 01:11:04 -04:00
|
|
|
{
|
2003-01-05 13:36:01 -05:00
|
|
|
if (layout.grid[i] >= 0)
|
2002-06-22 01:11:04 -04:00
|
|
|
{
|
|
|
|
MetaWorkspace *workspace;
|
2003-01-05 13:36:01 -05:00
|
|
|
|
|
|
|
workspace = meta_screen_get_workspace_by_index (screen,
|
|
|
|
layout.grid[i]);
|
|
|
|
|
2002-06-22 01:11:04 -04:00
|
|
|
entries[i].key = (MetaTabEntryKey) workspace;
|
2002-11-03 14:06:39 -05:00
|
|
|
entries[i].title = meta_workspace_get_name (workspace);
|
2002-07-06 15:05:37 -04:00
|
|
|
entries[i].icon = NULL;
|
2003-01-05 13:36:01 -05:00
|
|
|
entries[i].blank = FALSE;
|
|
|
|
|
2002-11-19 22:57:20 -05:00
|
|
|
g_assert (entries[i].title != NULL);
|
2002-06-22 01:11:04 -04:00
|
|
|
}
|
2003-01-05 13:36:01 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
entries[i].key = NULL;
|
|
|
|
entries[i].title = NULL;
|
|
|
|
entries[i].icon = NULL;
|
|
|
|
entries[i].blank = TRUE;
|
|
|
|
}
|
2005-11-11 19:34:32 -05:00
|
|
|
entries[i].hidden = FALSE;
|
2005-01-20 11:41:29 -05:00
|
|
|
entries[i].demands_attention = FALSE;
|
2003-01-05 13:36:01 -05:00
|
|
|
|
|
|
|
++i;
|
2002-06-22 01:11:04 -04:00
|
|
|
}
|
|
|
|
|
2009-04-27 10:49:03 -04:00
|
|
|
screen->ws_popup = meta_ui_tab_popup_new (entries,
|
|
|
|
screen->number,
|
|
|
|
len,
|
|
|
|
layout.cols,
|
|
|
|
FALSE);
|
2002-06-22 01:11:04 -04:00
|
|
|
|
|
|
|
g_free (entries);
|
2003-01-05 13:36:01 -05:00
|
|
|
meta_screen_free_workspace_layout (&layout);
|
2002-06-22 01:11:04 -04:00
|
|
|
|
2009-04-27 11:19:08 -04:00
|
|
|
meta_ui_tab_popup_select (screen->ws_popup,
|
|
|
|
(MetaTabEntryKey) initial_selection);
|
|
|
|
meta_ui_tab_popup_set_showing (screen->ws_popup, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_workspace_popup_select (MetaScreen *screen,
|
|
|
|
MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
g_return_if_fail (screen->ws_popup != NULL);
|
|
|
|
|
|
|
|
meta_ui_tab_popup_select (screen->ws_popup,
|
|
|
|
(MetaTabEntryKey) workspace);
|
|
|
|
}
|
|
|
|
|
|
|
|
MetaWorkspace *
|
|
|
|
meta_screen_workspace_popup_get_selected (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (screen->ws_popup != NULL, NULL);
|
|
|
|
|
|
|
|
return (MetaWorkspace *) meta_ui_tab_popup_get_selected (screen->ws_popup);
|
2002-06-22 01:11:04 -04:00
|
|
|
}
|
|
|
|
|
2009-04-27 10:01:30 -04:00
|
|
|
void
|
2009-04-27 11:19:08 -04:00
|
|
|
meta_screen_workspace_popup_destroy (MetaScreen *screen)
|
2009-04-27 10:01:30 -04:00
|
|
|
{
|
2009-04-27 10:49:03 -04:00
|
|
|
if (screen->ws_popup)
|
2009-04-27 10:01:30 -04:00
|
|
|
{
|
2009-04-27 10:49:03 -04:00
|
|
|
meta_ui_tab_popup_free (screen->ws_popup);
|
|
|
|
screen->ws_popup = NULL;
|
2009-04-27 10:01:30 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-24 16:02:46 -04:00
|
|
|
MetaWindow*
|
|
|
|
meta_screen_get_mouse_window (MetaScreen *screen,
|
|
|
|
MetaWindow *not_this_one)
|
2003-01-21 23:54:04 -05:00
|
|
|
{
|
|
|
|
MetaWindow *window;
|
|
|
|
Window root_return, child_return;
|
|
|
|
int root_x_return, root_y_return;
|
|
|
|
int win_x_return, win_y_return;
|
|
|
|
unsigned int mask_return;
|
|
|
|
|
|
|
|
if (not_this_one)
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focusing mouse window excluding %s\n", not_this_one->desc);
|
|
|
|
|
|
|
|
meta_error_trap_push (screen->display);
|
|
|
|
XQueryPointer (screen->display->xdisplay,
|
|
|
|
screen->xroot,
|
|
|
|
&root_return,
|
|
|
|
&child_return,
|
|
|
|
&root_x_return,
|
|
|
|
&root_y_return,
|
|
|
|
&win_x_return,
|
|
|
|
&win_y_return,
|
|
|
|
&mask_return);
|
|
|
|
meta_error_trap_pop (screen->display, TRUE);
|
|
|
|
|
|
|
|
window = meta_stack_get_default_focus_window_at_point (screen->stack,
|
|
|
|
screen->active_workspace,
|
|
|
|
not_this_one,
|
|
|
|
root_x_return,
|
|
|
|
root_y_return);
|
|
|
|
|
2004-06-24 16:02:46 -04:00
|
|
|
return window;
|
2003-01-21 23:54:04 -05:00
|
|
|
}
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
const MetaMonitorInfo*
|
|
|
|
meta_screen_get_monitor_for_rect (MetaScreen *screen,
|
|
|
|
MetaRectangle *rect)
|
2002-05-25 12:30:14 -04:00
|
|
|
{
|
|
|
|
int i;
|
2009-08-31 09:52:16 -04:00
|
|
|
int best_monitor, monitor_score;
|
2002-05-25 12:30:14 -04:00
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
if (screen->n_monitor_infos == 1)
|
|
|
|
return &screen->monitor_infos[0];
|
2003-02-23 12:09:46 -05:00
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
best_monitor = 0;
|
|
|
|
monitor_score = 0;
|
2002-05-25 12:30:14 -04:00
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
for (i = 0; i < screen->n_monitor_infos; i++)
|
2002-06-06 23:18:46 -04:00
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
MetaRectangle dest;
|
2009-08-31 09:52:16 -04:00
|
|
|
if (meta_rectangle_intersect (&screen->monitor_infos[i].rect,
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
rect,
|
|
|
|
&dest))
|
2002-06-06 23:18:46 -04:00
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
int cur = meta_rectangle_area (&dest);
|
2009-08-31 09:52:16 -04:00
|
|
|
if (cur > monitor_score)
|
2002-06-06 23:18:46 -04:00
|
|
|
{
|
2009-08-31 09:52:16 -04:00
|
|
|
monitor_score = cur;
|
|
|
|
best_monitor = i;
|
2002-06-06 23:18:46 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-05-25 12:30:14 -04:00
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
return &screen->monitor_infos[best_monitor];
|
2002-05-25 12:30:14 -04:00
|
|
|
}
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
const MetaMonitorInfo*
|
|
|
|
meta_screen_get_monitor_for_window (MetaScreen *screen,
|
|
|
|
MetaWindow *window)
|
2003-02-23 12:09:46 -05:00
|
|
|
{
|
|
|
|
MetaRectangle window_rect;
|
|
|
|
|
|
|
|
meta_window_get_outer_rect (window, &window_rect);
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
return meta_screen_get_monitor_for_rect (screen, &window_rect);
|
2003-02-23 12:09:46 -05:00
|
|
|
}
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
const MetaMonitorInfo*
|
|
|
|
meta_screen_get_monitor_neighbor (MetaScreen *screen,
|
|
|
|
int which_monitor,
|
|
|
|
MetaScreenDirection direction)
|
2003-04-06 00:57:36 -05:00
|
|
|
{
|
2009-08-31 09:52:16 -04:00
|
|
|
MetaMonitorInfo* input = screen->monitor_infos + which_monitor;
|
|
|
|
MetaMonitorInfo* current;
|
2003-04-06 00:57:36 -05:00
|
|
|
int i;
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
for (i = 0; i < screen->n_monitor_infos; i++)
|
2003-04-06 00:57:36 -05:00
|
|
|
{
|
2009-08-31 09:52:16 -04:00
|
|
|
current = screen->monitor_infos + i;
|
2003-04-06 00:57:36 -05:00
|
|
|
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
if ((direction == META_SCREEN_RIGHT &&
|
|
|
|
current->rect.x == input->rect.x + input->rect.width &&
|
|
|
|
meta_rectangle_vert_overlap(¤t->rect, &input->rect)) ||
|
|
|
|
(direction == META_SCREEN_LEFT &&
|
|
|
|
input->rect.x == current->rect.x + current->rect.width &&
|
|
|
|
meta_rectangle_vert_overlap(¤t->rect, &input->rect)) ||
|
|
|
|
(direction == META_SCREEN_UP &&
|
|
|
|
input->rect.y == current->rect.y + current->rect.height &&
|
|
|
|
meta_rectangle_horiz_overlap(¤t->rect, &input->rect)) ||
|
|
|
|
(direction == META_SCREEN_DOWN &&
|
|
|
|
current->rect.y == input->rect.y + input->rect.height &&
|
|
|
|
meta_rectangle_horiz_overlap(¤t->rect, &input->rect)))
|
2003-04-06 00:57:36 -05:00
|
|
|
{
|
|
|
|
return current;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-08-31 09:52:16 -04:00
|
|
|
meta_screen_get_natural_monitor_list (MetaScreen *screen,
|
|
|
|
int** monitors_list,
|
|
|
|
int* n_monitors)
|
2003-04-06 00:57:36 -05:00
|
|
|
{
|
2009-08-31 09:52:16 -04:00
|
|
|
const MetaMonitorInfo* current;
|
|
|
|
const MetaMonitorInfo* tmp;
|
|
|
|
GQueue* monitor_queue;
|
2003-04-06 00:57:36 -05:00
|
|
|
int* visited;
|
|
|
|
int cur = 0;
|
|
|
|
int i;
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
*n_monitors = screen->n_monitor_infos;
|
|
|
|
*monitors_list = g_new (int, screen->n_monitor_infos);
|
2003-04-06 00:57:36 -05:00
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
/* we calculate a natural ordering by which to choose monitors for
|
|
|
|
* window placement. We start at the current monitor, and perform
|
|
|
|
* a breadth-first search of the monitors starting from that
|
|
|
|
* monitor. We choose preferentially left, then right, then down,
|
2003-04-06 00:57:36 -05:00
|
|
|
* then up. The visitation order produced by this traversal is the
|
2009-08-31 09:52:16 -04:00
|
|
|
* natural monitor ordering.
|
2003-04-06 00:57:36 -05:00
|
|
|
*/
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
visited = g_new (int, screen->n_monitor_infos);
|
|
|
|
for (i = 0; i < screen->n_monitor_infos; i++)
|
2003-04-06 00:57:36 -05:00
|
|
|
{
|
|
|
|
visited[i] = FALSE;
|
|
|
|
}
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
current = meta_screen_get_current_monitor (screen);
|
|
|
|
monitor_queue = g_queue_new ();
|
|
|
|
g_queue_push_tail (monitor_queue, (gpointer) current);
|
2003-04-06 00:57:36 -05:00
|
|
|
visited[current->number] = TRUE;
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
while (!g_queue_is_empty (monitor_queue))
|
2003-04-06 00:57:36 -05:00
|
|
|
{
|
2009-08-31 09:52:16 -04:00
|
|
|
current = (const MetaMonitorInfo*)
|
|
|
|
g_queue_pop_head (monitor_queue);
|
2003-04-06 00:57:36 -05:00
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
(*monitors_list)[cur++] = current->number;
|
2003-04-06 00:57:36 -05:00
|
|
|
|
|
|
|
/* enqueue each of the directions */
|
2009-08-31 09:52:16 -04:00
|
|
|
tmp = meta_screen_get_monitor_neighbor (screen,
|
|
|
|
current->number,
|
|
|
|
META_SCREEN_LEFT);
|
2003-04-06 00:57:36 -05:00
|
|
|
if (tmp && !visited[tmp->number])
|
|
|
|
{
|
2009-08-31 09:52:16 -04:00
|
|
|
g_queue_push_tail (monitor_queue,
|
|
|
|
(MetaMonitorInfo*) tmp);
|
2003-04-06 00:57:36 -05:00
|
|
|
visited[tmp->number] = TRUE;
|
|
|
|
}
|
2009-08-31 09:52:16 -04:00
|
|
|
tmp = meta_screen_get_monitor_neighbor (screen,
|
|
|
|
current->number,
|
|
|
|
META_SCREEN_RIGHT);
|
2003-04-06 00:57:36 -05:00
|
|
|
if (tmp && !visited[tmp->number])
|
|
|
|
{
|
2009-08-31 09:52:16 -04:00
|
|
|
g_queue_push_tail (monitor_queue,
|
|
|
|
(MetaMonitorInfo*) tmp);
|
2003-04-06 00:57:36 -05:00
|
|
|
visited[tmp->number] = TRUE;
|
|
|
|
}
|
2009-08-31 09:52:16 -04:00
|
|
|
tmp = meta_screen_get_monitor_neighbor (screen,
|
|
|
|
current->number,
|
|
|
|
META_SCREEN_UP);
|
2003-04-06 00:57:36 -05:00
|
|
|
if (tmp && !visited[tmp->number])
|
|
|
|
{
|
2009-08-31 09:52:16 -04:00
|
|
|
g_queue_push_tail (monitor_queue,
|
|
|
|
(MetaMonitorInfo*) tmp);
|
2003-04-06 00:57:36 -05:00
|
|
|
visited[tmp->number] = TRUE;
|
|
|
|
}
|
2009-08-31 09:52:16 -04:00
|
|
|
tmp = meta_screen_get_monitor_neighbor (screen,
|
|
|
|
current->number,
|
|
|
|
META_SCREEN_DOWN);
|
2003-04-06 00:57:36 -05:00
|
|
|
if (tmp && !visited[tmp->number])
|
|
|
|
{
|
2009-08-31 09:52:16 -04:00
|
|
|
g_queue_push_tail (monitor_queue,
|
|
|
|
(MetaMonitorInfo*) tmp);
|
2003-04-06 00:57:36 -05:00
|
|
|
visited[tmp->number] = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
/* in case we somehow missed some set of monitors, go through the
|
|
|
|
* visited list and add in any monitors that were missed
|
2003-04-06 00:57:36 -05:00
|
|
|
*/
|
2009-08-31 09:52:16 -04:00
|
|
|
for (i = 0; i < screen->n_monitor_infos; i++)
|
2003-04-06 00:57:36 -05:00
|
|
|
{
|
|
|
|
if (visited[i] == FALSE)
|
|
|
|
{
|
2009-08-31 09:52:16 -04:00
|
|
|
(*monitors_list)[cur++] = i;
|
2003-04-06 00:57:36 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (visited);
|
2009-08-31 09:52:16 -04:00
|
|
|
g_queue_free (monitor_queue);
|
2003-04-06 00:57:36 -05:00
|
|
|
}
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
const MetaMonitorInfo*
|
|
|
|
meta_screen_get_current_monitor (MetaScreen *screen)
|
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
|
|
|
{
|
2009-08-31 09:52:16 -04:00
|
|
|
if (screen->n_monitor_infos == 1)
|
|
|
|
return &screen->monitor_infos[0];
|
2003-02-23 12:09:46 -05:00
|
|
|
|
2002-06-06 23:18:46 -04:00
|
|
|
/* Sadly, we have to do it this way. Yuck.
|
|
|
|
*/
|
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
if (screen->display->monitor_cache_invalidated)
|
2002-06-06 23:18:46 -04:00
|
|
|
{
|
|
|
|
Window root_return, child_return;
|
|
|
|
int win_x_return, win_y_return;
|
|
|
|
unsigned int mask_return;
|
|
|
|
int i;
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
MetaRectangle pointer_position;
|
2002-06-06 23:18:46 -04:00
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
screen->display->monitor_cache_invalidated = FALSE;
|
2002-06-06 23:18:46 -04:00
|
|
|
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
pointer_position.width = pointer_position.height = 1;
|
2002-06-06 23:18:46 -04:00
|
|
|
XQueryPointer (screen->display->xdisplay,
|
|
|
|
screen->xroot,
|
|
|
|
&root_return,
|
|
|
|
&child_return,
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
&pointer_position.x,
|
|
|
|
&pointer_position.y,
|
2002-06-06 23:18:46 -04:00
|
|
|
&win_x_return,
|
|
|
|
&win_y_return,
|
|
|
|
&mask_return);
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
screen->last_monitor_index = 0;
|
|
|
|
for (i = 0; i < screen->n_monitor_infos; i++)
|
2002-06-06 23:18:46 -04:00
|
|
|
{
|
2009-08-31 09:52:16 -04:00
|
|
|
if (meta_rectangle_contains_rect (&screen->monitor_infos[i].rect,
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
&pointer_position))
|
|
|
|
{
|
2009-08-31 09:52:16 -04:00
|
|
|
screen->last_monitor_index = i;
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
break;
|
|
|
|
}
|
2002-06-06 23:18:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_XINERAMA,
|
2009-08-31 09:52:16 -04:00
|
|
|
"Rechecked current monitor, now %d\n",
|
|
|
|
screen->last_monitor_index);
|
2002-06-06 23:18:46 -04:00
|
|
|
}
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
return &screen->monitor_infos[screen->last_monitor_index];
|
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
|
|
|
}
|
2002-05-16 00:03:36 -04:00
|
|
|
|
2009-08-31 10:06:17 -04:00
|
|
|
/**
|
|
|
|
* meta_screen_get_n_monitors:
|
|
|
|
* @screen: a #MetaScreen
|
|
|
|
*
|
|
|
|
* Gets the number of monitors that are joined together to form @screen.
|
|
|
|
*
|
|
|
|
* Return value: the number of monitors
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
meta_screen_get_n_monitors (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (META_IS_SCREEN (screen), 0);
|
|
|
|
|
|
|
|
return screen->n_monitor_infos;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* meta_screen_get_monitor_geometry:
|
|
|
|
* @screen: a #MetaScreen
|
|
|
|
* @monitor: the monitor number
|
|
|
|
* @geometry: (out): location to store the monitor geometry
|
|
|
|
*
|
|
|
|
* Stores the location and size of the indicated monitor in @geometry.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
meta_screen_get_monitor_geometry (MetaScreen *screen,
|
|
|
|
int monitor,
|
|
|
|
MetaRectangle *geometry)
|
|
|
|
{
|
|
|
|
g_return_if_fail (META_IS_SCREEN (screen));
|
|
|
|
g_return_if_fail (monitor >= 0 && monitor < screen->n_monitor_infos);
|
|
|
|
g_return_if_fail (geometry != NULL);
|
|
|
|
|
|
|
|
*geometry = screen->monitor_infos[monitor].rect;
|
|
|
|
}
|
|
|
|
|
2002-05-16 00:03:36 -04:00
|
|
|
#define _NET_WM_ORIENTATION_HORZ 0
|
|
|
|
#define _NET_WM_ORIENTATION_VERT 1
|
|
|
|
|
2002-10-01 15:57:26 -04:00
|
|
|
#define _NET_WM_TOPLEFT 0
|
|
|
|
#define _NET_WM_TOPRIGHT 1
|
|
|
|
#define _NET_WM_BOTTOMRIGHT 2
|
|
|
|
#define _NET_WM_BOTTOMLEFT 3
|
|
|
|
|
2002-05-16 00:03:36 -04:00
|
|
|
void
|
|
|
|
meta_screen_update_workspace_layout (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
gulong *list;
|
|
|
|
int n_items;
|
|
|
|
|
|
|
|
list = NULL;
|
|
|
|
n_items = 0;
|
|
|
|
|
|
|
|
if (meta_prop_get_cardinal_list (screen->display,
|
|
|
|
screen->xroot,
|
2008-05-02 14:49:01 -04:00
|
|
|
screen->display->atom__NET_DESKTOP_LAYOUT,
|
2002-05-16 00:03:36 -04:00
|
|
|
&list, &n_items))
|
|
|
|
{
|
2002-10-01 15:57:26 -04:00
|
|
|
if (n_items == 3 || n_items == 4)
|
2002-05-16 00:03:36 -04:00
|
|
|
{
|
|
|
|
int cols, rows;
|
|
|
|
|
|
|
|
switch (list[0])
|
|
|
|
{
|
|
|
|
case _NET_WM_ORIENTATION_HORZ:
|
|
|
|
screen->vertical_workspaces = FALSE;
|
|
|
|
break;
|
|
|
|
case _NET_WM_ORIENTATION_VERT:
|
|
|
|
screen->vertical_workspaces = TRUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
meta_warning ("Someone set a weird orientation in _NET_DESKTOP_LAYOUT\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-10-01 15:57:26 -04:00
|
|
|
cols = list[1];
|
|
|
|
rows = list[2];
|
2002-05-16 00:03:36 -04:00
|
|
|
|
|
|
|
if (rows <= 0 && cols <= 0)
|
|
|
|
{
|
|
|
|
meta_warning ("Columns = %d rows = %d in _NET_DESKTOP_LAYOUT makes no sense\n", rows, cols);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (rows > 0)
|
|
|
|
screen->rows_of_workspaces = rows;
|
|
|
|
else
|
|
|
|
screen->rows_of_workspaces = -1;
|
|
|
|
|
|
|
|
if (cols > 0)
|
|
|
|
screen->columns_of_workspaces = cols;
|
|
|
|
else
|
|
|
|
screen->columns_of_workspaces = -1;
|
|
|
|
}
|
2002-10-01 15:57:26 -04:00
|
|
|
|
|
|
|
if (n_items == 4)
|
|
|
|
{
|
|
|
|
switch (list[3])
|
|
|
|
{
|
|
|
|
case _NET_WM_TOPLEFT:
|
|
|
|
screen->starting_corner = META_SCREEN_TOPLEFT;
|
|
|
|
break;
|
|
|
|
case _NET_WM_TOPRIGHT:
|
|
|
|
screen->starting_corner = META_SCREEN_TOPRIGHT;
|
|
|
|
break;
|
|
|
|
case _NET_WM_BOTTOMRIGHT:
|
|
|
|
screen->starting_corner = META_SCREEN_BOTTOMRIGHT;
|
|
|
|
break;
|
|
|
|
case _NET_WM_BOTTOMLEFT:
|
|
|
|
screen->starting_corner = META_SCREEN_BOTTOMLEFT;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
meta_warning ("Someone set a weird starting corner in _NET_DESKTOP_LAYOUT\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-11-16 19:06:58 -05:00
|
|
|
else
|
|
|
|
screen->starting_corner = META_SCREEN_TOPLEFT;
|
2002-05-16 00:03:36 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-10-01 15:57:26 -04:00
|
|
|
meta_warning ("Someone set _NET_DESKTOP_LAYOUT to %d integers instead of 4 "
|
|
|
|
"(3 is accepted for backwards compat)\n", n_items);
|
2002-05-16 00:03:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
meta_XFree (list);
|
|
|
|
}
|
|
|
|
|
2006-01-20 17:03:56 -05:00
|
|
|
meta_verbose ("Workspace layout rows = %d cols = %d orientation = %d starting corner = %u\n",
|
2002-05-16 00:03:36 -04:00
|
|
|
screen->rows_of_workspaces,
|
|
|
|
screen->columns_of_workspaces,
|
2002-10-01 15:57:26 -04:00
|
|
|
screen->vertical_workspaces,
|
|
|
|
screen->starting_corner);
|
2002-05-16 00:03:36 -04:00
|
|
|
}
|
2002-06-08 23:44:16 -04:00
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
static void
|
2003-02-14 02:03:46 -05:00
|
|
|
set_workspace_names (MetaScreen *screen)
|
2002-11-03 14:06:39 -05:00
|
|
|
{
|
|
|
|
/* This updates names on root window when the pref changes,
|
|
|
|
* note we only get prefs change notify if things have
|
|
|
|
* really changed.
|
|
|
|
*/
|
|
|
|
GString *flattened;
|
|
|
|
int i;
|
|
|
|
int n_spaces;
|
|
|
|
|
|
|
|
/* flatten to nul-separated list */
|
|
|
|
n_spaces = meta_screen_get_n_workspaces (screen);
|
|
|
|
flattened = g_string_new ("");
|
|
|
|
i = 0;
|
|
|
|
while (i < n_spaces)
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
name = meta_prefs_get_workspace_name (i);
|
|
|
|
|
|
|
|
if (name)
|
2002-11-19 22:57:20 -05:00
|
|
|
g_string_append_len (flattened, name,
|
2002-11-03 14:06:39 -05:00
|
|
|
strlen (name) + 1);
|
|
|
|
else
|
|
|
|
g_string_append_len (flattened, "", 1);
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_error_trap_push (screen->display);
|
|
|
|
XChangeProperty (screen->display->xdisplay,
|
|
|
|
screen->xroot,
|
2008-05-02 14:49:01 -04:00
|
|
|
screen->display->atom__NET_DESKTOP_NAMES,
|
|
|
|
screen->display->atom_UTF8_STRING,
|
2002-11-03 14:06:39 -05:00
|
|
|
8, PropModeReplace,
|
2006-04-13 09:16:42 -04:00
|
|
|
(unsigned char *)flattened->str, flattened->len);
|
2002-11-03 14:06:39 -05:00
|
|
|
meta_error_trap_pop (screen->display, FALSE);
|
|
|
|
|
|
|
|
g_string_free (flattened, TRUE);
|
|
|
|
}
|
|
|
|
|
2002-06-22 00:52:35 -04:00
|
|
|
void
|
|
|
|
meta_screen_update_workspace_names (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
char **names;
|
|
|
|
int n_names;
|
|
|
|
int i;
|
2002-11-03 14:06:39 -05:00
|
|
|
|
|
|
|
/* this updates names in prefs when the root window property changes,
|
|
|
|
* iff the new property contents don't match what's already in prefs
|
|
|
|
*/
|
2002-06-22 00:52:35 -04:00
|
|
|
|
|
|
|
names = NULL;
|
|
|
|
n_names = 0;
|
|
|
|
if (!meta_prop_get_utf8_list (screen->display,
|
|
|
|
screen->xroot,
|
2008-05-02 14:49:01 -04:00
|
|
|
screen->display->atom__NET_DESKTOP_NAMES,
|
2002-06-22 00:52:35 -04:00
|
|
|
&names, &n_names))
|
|
|
|
{
|
|
|
|
meta_verbose ("Failed to get workspace names from root window %d\n",
|
|
|
|
screen->number);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
i = 0;
|
2002-11-03 14:06:39 -05:00
|
|
|
while (i < n_names)
|
2002-06-22 00:52:35 -04:00
|
|
|
{
|
2002-11-19 22:57:20 -05:00
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
"Setting workspace %d name to \"%s\" due to _NET_DESKTOP_NAMES change\n",
|
|
|
|
i, names[i] ? names[i] : "null");
|
2002-11-03 14:06:39 -05:00
|
|
|
meta_prefs_change_workspace_name (i, names[i]);
|
2002-06-22 00:52:35 -04:00
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
++i;
|
2002-06-22 00:52:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
g_strfreev (names);
|
|
|
|
}
|
|
|
|
|
2002-06-08 23:44:16 -04:00
|
|
|
Window
|
|
|
|
meta_create_offscreen_window (Display *xdisplay,
|
2007-03-31 19:34:36 -04:00
|
|
|
Window parent,
|
|
|
|
long valuemask)
|
2002-06-08 23:44:16 -04:00
|
|
|
{
|
|
|
|
XSetWindowAttributes attrs;
|
|
|
|
|
|
|
|
/* we want to be override redirect because sometimes we
|
|
|
|
* create a window on a screen we aren't managing.
|
|
|
|
* (but on a display we are managing at least one screen for)
|
|
|
|
*/
|
|
|
|
attrs.override_redirect = True;
|
2007-03-31 19:34:36 -04:00
|
|
|
attrs.event_mask = valuemask;
|
2002-06-08 23:44:16 -04:00
|
|
|
|
|
|
|
return XCreateWindow (xdisplay,
|
|
|
|
parent,
|
|
|
|
-100, -100, 1, 1,
|
|
|
|
0,
|
|
|
|
CopyFromParent,
|
|
|
|
CopyFromParent,
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
(Visual *)CopyFromParent,
|
2003-11-24 13:38:38 -05:00
|
|
|
CWOverrideRedirect | CWEventMask,
|
2002-06-08 23:44:16 -04:00
|
|
|
&attrs);
|
|
|
|
}
|
2002-06-22 01:11:04 -04:00
|
|
|
|
2002-10-21 17:44:35 -04:00
|
|
|
static void
|
2002-06-24 21:12:37 -04:00
|
|
|
set_work_area_hint (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
int num_workspaces;
|
|
|
|
GList *tmp_list;
|
|
|
|
unsigned long *data, *tmp;
|
|
|
|
MetaRectangle area;
|
|
|
|
|
|
|
|
num_workspaces = meta_screen_get_n_workspaces (screen);
|
|
|
|
data = g_new (unsigned long, num_workspaces * 4);
|
2002-10-16 16:12:24 -04:00
|
|
|
tmp_list = screen->workspaces;
|
2002-06-24 21:12:37 -04:00
|
|
|
tmp = data;
|
|
|
|
|
|
|
|
while (tmp_list != NULL)
|
|
|
|
{
|
|
|
|
MetaWorkspace *workspace = tmp_list->data;
|
|
|
|
|
|
|
|
if (workspace->screen == screen)
|
|
|
|
{
|
2009-08-31 09:52:16 -04:00
|
|
|
meta_workspace_get_work_area_all_monitors (workspace, &area);
|
2002-06-24 21:12:37 -04:00
|
|
|
tmp[0] = area.x;
|
|
|
|
tmp[1] = area.y;
|
|
|
|
tmp[2] = area.width;
|
|
|
|
tmp[3] = area.height;
|
|
|
|
|
|
|
|
tmp += 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_error_trap_push (screen->display);
|
|
|
|
XChangeProperty (screen->display->xdisplay, screen->xroot,
|
2008-05-02 14:49:01 -04:00
|
|
|
screen->display->atom__NET_WORKAREA,
|
2002-06-24 21:12:37 -04:00
|
|
|
XA_CARDINAL, 32, PropModeReplace,
|
|
|
|
(guchar*) data, num_workspaces*4);
|
|
|
|
g_free (data);
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_pop (screen->display, FALSE);
|
2009-09-17 04:49:23 -04:00
|
|
|
|
|
|
|
g_signal_emit (screen, screen_signals[WORKAREAS_CHANGED], 0);
|
2002-06-24 21:12:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2009-09-25 15:47:22 -04:00
|
|
|
set_work_area_later_func (MetaScreen *screen)
|
2002-06-24 21:12:37 -04:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
2009-09-25 15:47:22 -04:00
|
|
|
"Running work area hint computation function\n");
|
2002-06-24 21:12:37 -04:00
|
|
|
|
2009-09-25 15:47:22 -04:00
|
|
|
screen->work_area_later = 0;
|
2002-06-24 21:12:37 -04:00
|
|
|
|
|
|
|
set_work_area_hint (screen);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_queue_workarea_recalc (MetaScreen *screen)
|
|
|
|
{
|
2009-09-25 15:47:22 -04:00
|
|
|
/* Recompute work area later before redrawing */
|
|
|
|
if (screen->work_area_later == 0)
|
2002-06-24 21:12:37 -04:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
2009-09-25 15:47:22 -04:00
|
|
|
"Adding work area hint computation function\n");
|
|
|
|
screen->work_area_later =
|
|
|
|
meta_later_add (META_LATER_BEFORE_REDRAW,
|
|
|
|
(GSourceFunc) set_work_area_later_func,
|
|
|
|
screen,
|
|
|
|
NULL);
|
2002-06-24 21:12:37 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-05 13:36:01 -05:00
|
|
|
|
|
|
|
#ifdef WITH_VERBOSE_MODE
|
|
|
|
static char *
|
|
|
|
meta_screen_corner_to_string (MetaScreenCorner corner)
|
|
|
|
{
|
|
|
|
switch (corner)
|
|
|
|
{
|
|
|
|
case META_SCREEN_TOPLEFT:
|
|
|
|
return "TopLeft";
|
|
|
|
case META_SCREEN_TOPRIGHT:
|
|
|
|
return "TopRight";
|
|
|
|
case META_SCREEN_BOTTOMLEFT:
|
|
|
|
return "BottomLeft";
|
|
|
|
case META_SCREEN_BOTTOMRIGHT:
|
|
|
|
return "BottomRight";
|
|
|
|
}
|
|
|
|
|
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
|
|
|
|
2002-06-22 01:11:04 -04:00
|
|
|
void
|
2003-01-05 13:36:01 -05:00
|
|
|
meta_screen_calc_workspace_layout (MetaScreen *screen,
|
|
|
|
int num_workspaces,
|
|
|
|
int current_space,
|
|
|
|
MetaWorkspaceLayout *layout)
|
2002-06-22 01:11:04 -04:00
|
|
|
{
|
2003-01-05 13:36:01 -05:00
|
|
|
int rows, cols;
|
|
|
|
int grid_area;
|
|
|
|
int *grid;
|
|
|
|
int i, r, c;
|
|
|
|
int current_row, current_col;
|
|
|
|
|
2002-06-22 01:11:04 -04:00
|
|
|
rows = screen->rows_of_workspaces;
|
|
|
|
cols = screen->columns_of_workspaces;
|
|
|
|
if (rows <= 0 && cols <= 0)
|
|
|
|
cols = num_workspaces;
|
|
|
|
|
|
|
|
if (rows <= 0)
|
|
|
|
rows = num_workspaces / cols + ((num_workspaces % cols) > 0 ? 1 : 0);
|
|
|
|
if (cols <= 0)
|
|
|
|
cols = num_workspaces / rows + ((num_workspaces % rows) > 0 ? 1 : 0);
|
|
|
|
|
|
|
|
/* paranoia */
|
|
|
|
if (rows < 1)
|
|
|
|
rows = 1;
|
|
|
|
if (cols < 1)
|
|
|
|
cols = 1;
|
|
|
|
|
2003-01-05 13:36:01 -05:00
|
|
|
g_assert (rows != 0 && cols != 0);
|
|
|
|
|
|
|
|
grid_area = rows * cols;
|
|
|
|
|
|
|
|
meta_verbose ("Getting layout rows = %d cols = %d current = %d "
|
|
|
|
"num_spaces = %d vertical = %s corner = %s\n",
|
|
|
|
rows, cols, current_space, num_workspaces,
|
|
|
|
screen->vertical_workspaces ? "(true)" : "(false)",
|
|
|
|
meta_screen_corner_to_string (screen->starting_corner));
|
|
|
|
|
|
|
|
/* ok, we want to setup the distances in the workspace array to go
|
|
|
|
* in each direction. Remember, there are many ways that a workspace
|
|
|
|
* array can be setup.
|
|
|
|
* see http://www.freedesktop.org/standards/wm-spec/1.2/html/x109.html
|
|
|
|
* and look at the _NET_DESKTOP_LAYOUT section for details.
|
|
|
|
* For instance:
|
|
|
|
*/
|
|
|
|
/* starting_corner = META_SCREEN_TOPLEFT
|
|
|
|
* vertical_workspaces = 0 vertical_workspaces=1
|
|
|
|
* 1234 1357
|
|
|
|
* 5678 2468
|
|
|
|
*
|
|
|
|
* starting_corner = META_SCREEN_TOPRIGHT
|
|
|
|
* vertical_workspaces = 0 vertical_workspaces=1
|
|
|
|
* 4321 7531
|
|
|
|
* 8765 8642
|
|
|
|
*
|
|
|
|
* starting_corner = META_SCREEN_BOTTOMLEFT
|
|
|
|
* vertical_workspaces = 0 vertical_workspaces=1
|
|
|
|
* 5678 2468
|
|
|
|
* 1234 1357
|
|
|
|
*
|
|
|
|
* starting_corner = META_SCREEN_BOTTOMRIGHT
|
|
|
|
* vertical_workspaces = 0 vertical_workspaces=1
|
|
|
|
* 8765 8642
|
|
|
|
* 4321 7531
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
/* keep in mind that we could have a ragged layout, e.g. the "8"
|
|
|
|
* in the above grids could be missing
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
grid = g_new (int, grid_area);
|
|
|
|
|
|
|
|
current_row = -1;
|
|
|
|
current_col = -1;
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
switch (screen->starting_corner)
|
|
|
|
{
|
|
|
|
case META_SCREEN_TOPLEFT:
|
|
|
|
if (screen->vertical_workspaces)
|
|
|
|
{
|
|
|
|
c = 0;
|
|
|
|
while (c < cols)
|
|
|
|
{
|
|
|
|
r = 0;
|
|
|
|
while (r < rows)
|
|
|
|
{
|
|
|
|
grid[r*cols+c] = i;
|
|
|
|
++i;
|
|
|
|
++r;
|
|
|
|
}
|
|
|
|
++c;
|
|
|
|
}
|
|
|
|
}
|
2003-01-05 21:59:19 -05:00
|
|
|
else
|
2003-01-05 13:36:01 -05:00
|
|
|
{
|
|
|
|
r = 0;
|
|
|
|
while (r < rows)
|
|
|
|
{
|
2003-01-05 21:59:19 -05:00
|
|
|
c = 0;
|
|
|
|
while (c < cols)
|
2003-01-05 13:36:01 -05:00
|
|
|
{
|
|
|
|
grid[r*cols+c] = i;
|
|
|
|
++i;
|
2003-01-05 21:59:19 -05:00
|
|
|
++c;
|
2003-01-05 13:36:01 -05:00
|
|
|
}
|
|
|
|
++r;
|
|
|
|
}
|
|
|
|
}
|
2003-01-05 21:59:19 -05:00
|
|
|
break;
|
|
|
|
case META_SCREEN_TOPRIGHT:
|
|
|
|
if (screen->vertical_workspaces)
|
2003-01-05 13:36:01 -05:00
|
|
|
{
|
|
|
|
c = cols - 1;
|
|
|
|
while (c >= 0)
|
|
|
|
{
|
|
|
|
r = 0;
|
|
|
|
while (r < rows)
|
|
|
|
{
|
|
|
|
grid[r*cols+c] = i;
|
|
|
|
++i;
|
|
|
|
++r;
|
|
|
|
}
|
|
|
|
--c;
|
|
|
|
}
|
|
|
|
}
|
2003-01-05 21:59:19 -05:00
|
|
|
else
|
2003-01-05 13:36:01 -05:00
|
|
|
{
|
2003-01-05 21:59:19 -05:00
|
|
|
r = 0;
|
|
|
|
while (r < rows)
|
2003-01-05 13:36:01 -05:00
|
|
|
{
|
2003-01-05 21:59:19 -05:00
|
|
|
c = cols - 1;
|
|
|
|
while (c >= 0)
|
2003-01-05 13:36:01 -05:00
|
|
|
{
|
|
|
|
grid[r*cols+c] = i;
|
|
|
|
++i;
|
2003-01-05 21:59:19 -05:00
|
|
|
--c;
|
2003-01-05 13:36:01 -05:00
|
|
|
}
|
2003-01-05 21:59:19 -05:00
|
|
|
++r;
|
2003-01-05 13:36:01 -05:00
|
|
|
}
|
|
|
|
}
|
2003-01-05 21:59:19 -05:00
|
|
|
break;
|
|
|
|
case META_SCREEN_BOTTOMLEFT:
|
|
|
|
if (screen->vertical_workspaces)
|
2003-01-05 13:36:01 -05:00
|
|
|
{
|
|
|
|
c = 0;
|
|
|
|
while (c < cols)
|
|
|
|
{
|
|
|
|
r = rows - 1;
|
|
|
|
while (r >= 0)
|
|
|
|
{
|
|
|
|
grid[r*cols+c] = i;
|
|
|
|
++i;
|
|
|
|
--r;
|
|
|
|
}
|
|
|
|
++c;
|
|
|
|
}
|
|
|
|
}
|
2003-01-05 21:59:19 -05:00
|
|
|
else
|
2003-01-05 13:36:01 -05:00
|
|
|
{
|
|
|
|
r = rows - 1;
|
|
|
|
while (r >= 0)
|
|
|
|
{
|
2003-01-05 21:59:19 -05:00
|
|
|
c = 0;
|
|
|
|
while (c < cols)
|
2003-01-05 13:36:01 -05:00
|
|
|
{
|
|
|
|
grid[r*cols+c] = i;
|
|
|
|
++i;
|
2003-01-05 21:59:19 -05:00
|
|
|
++c;
|
2003-01-05 13:36:01 -05:00
|
|
|
}
|
|
|
|
--r;
|
|
|
|
}
|
|
|
|
}
|
2003-01-05 21:59:19 -05:00
|
|
|
break;
|
|
|
|
case META_SCREEN_BOTTOMRIGHT:
|
|
|
|
if (screen->vertical_workspaces)
|
2003-01-05 13:36:01 -05:00
|
|
|
{
|
|
|
|
c = cols - 1;
|
|
|
|
while (c >= 0)
|
|
|
|
{
|
|
|
|
r = rows - 1;
|
|
|
|
while (r >= 0)
|
|
|
|
{
|
|
|
|
grid[r*cols+c] = i;
|
|
|
|
++i;
|
|
|
|
--r;
|
|
|
|
}
|
|
|
|
--c;
|
|
|
|
}
|
|
|
|
}
|
2003-01-05 21:59:19 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
r = rows - 1;
|
|
|
|
while (r >= 0)
|
|
|
|
{
|
|
|
|
c = cols - 1;
|
|
|
|
while (c >= 0)
|
|
|
|
{
|
|
|
|
grid[r*cols+c] = i;
|
|
|
|
++i;
|
|
|
|
--c;
|
|
|
|
}
|
|
|
|
--r;
|
|
|
|
}
|
|
|
|
}
|
2003-01-05 13:36:01 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i != grid_area)
|
|
|
|
meta_bug ("did not fill in the whole workspace grid in %s (%d filled)\n",
|
2008-01-28 09:52:34 -05:00
|
|
|
G_STRFUNC, i);
|
2003-01-05 13:36:01 -05:00
|
|
|
|
|
|
|
current_row = 0;
|
|
|
|
current_col = 0;
|
|
|
|
r = 0;
|
|
|
|
while (r < rows)
|
|
|
|
{
|
|
|
|
c = 0;
|
|
|
|
while (c < cols)
|
|
|
|
{
|
|
|
|
if (grid[r*cols+c] == current_space)
|
|
|
|
{
|
|
|
|
current_row = r;
|
|
|
|
current_col = c;
|
|
|
|
}
|
|
|
|
else if (grid[r*cols+c] >= num_workspaces)
|
|
|
|
{
|
|
|
|
/* flag nonexistent spaces with -1 */
|
|
|
|
grid[r*cols+c] = -1;
|
|
|
|
}
|
|
|
|
++c;
|
|
|
|
}
|
|
|
|
++r;
|
|
|
|
}
|
|
|
|
|
|
|
|
layout->rows = rows;
|
|
|
|
layout->cols = cols;
|
|
|
|
layout->grid = grid;
|
|
|
|
layout->grid_area = grid_area;
|
|
|
|
layout->current_row = current_row;
|
|
|
|
layout->current_col = current_col;
|
|
|
|
|
|
|
|
#ifdef WITH_VERBOSE_MODE
|
|
|
|
if (meta_is_verbose ())
|
|
|
|
{
|
|
|
|
r = 0;
|
|
|
|
while (r < layout->rows)
|
|
|
|
{
|
2003-01-05 21:59:19 -05:00
|
|
|
meta_verbose (" ");
|
2003-01-05 13:36:01 -05:00
|
|
|
meta_push_no_msg_prefix ();
|
|
|
|
c = 0;
|
|
|
|
while (c < layout->cols)
|
|
|
|
{
|
|
|
|
if (r == layout->current_row &&
|
|
|
|
c == layout->current_col)
|
|
|
|
meta_verbose ("*%2d ", layout->grid[r*layout->cols+c]);
|
|
|
|
else
|
|
|
|
meta_verbose ("%3d ", layout->grid[r*layout->cols+c]);
|
|
|
|
++c;
|
|
|
|
}
|
|
|
|
meta_verbose ("\n");
|
|
|
|
meta_pop_no_msg_prefix ();
|
|
|
|
++r;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_free_workspace_layout (MetaWorkspaceLayout *layout)
|
|
|
|
{
|
|
|
|
g_free (layout->grid);
|
2002-06-22 01:11:04 -04:00
|
|
|
}
|
2002-09-28 22:50:24 -04:00
|
|
|
|
2002-10-01 20:47:29 -04:00
|
|
|
static void
|
2002-09-28 22:50:24 -04:00
|
|
|
meta_screen_resize_func (MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
void *user_data)
|
|
|
|
{
|
2003-06-25 23:09:38 -04:00
|
|
|
if (window->struts)
|
|
|
|
{
|
|
|
|
meta_window_update_struts (window);
|
|
|
|
}
|
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
|
|
|
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
|
2006-08-07 13:18:33 -04:00
|
|
|
|
|
|
|
meta_window_recalc_features (window);
|
2002-09-28 22:50:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_resize (MetaScreen *screen,
|
|
|
|
int width,
|
|
|
|
int height)
|
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
screen->rect.width = width;
|
|
|
|
screen->rect.height = height;
|
2002-09-28 22:50:24 -04:00
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
reload_monitor_infos (screen);
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
set_desktop_geometry_hint (screen);
|
2002-09-28 22:50:24 -04:00
|
|
|
|
2008-11-27 08:40:52 -05:00
|
|
|
if (screen->display->compositor)
|
|
|
|
meta_compositor_sync_screen_size (screen->display->compositor,
|
|
|
|
screen, width, height);
|
|
|
|
|
2002-09-28 22:50:24 -04:00
|
|
|
/* Queue a resize on all the windows */
|
|
|
|
meta_screen_foreach_window (screen, meta_screen_resize_func, 0);
|
|
|
|
}
|
2002-10-16 16:12:24 -04:00
|
|
|
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 00:28:29 -04:00
|
|
|
void
|
|
|
|
meta_screen_update_showing_desktop_hint (MetaScreen *screen)
|
2002-10-16 16:12:24 -04:00
|
|
|
{
|
|
|
|
unsigned long data[1];
|
|
|
|
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 00:28:29 -04:00
|
|
|
data[0] = screen->active_workspace->showing_desktop ? 1 : 0;
|
2002-10-16 16:12:24 -04:00
|
|
|
|
|
|
|
meta_error_trap_push (screen->display);
|
|
|
|
XChangeProperty (screen->display->xdisplay, screen->xroot,
|
2008-05-02 14:49:01 -04:00
|
|
|
screen->display->atom__NET_SHOWING_DESKTOP,
|
2002-10-16 16:12:24 -04:00
|
|
|
XA_CARDINAL,
|
|
|
|
32, PropModeReplace, (guchar*) data, 1);
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_pop (screen->display, FALSE);
|
2002-10-16 16:12:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
queue_windows_showing (MetaScreen *screen)
|
|
|
|
{
|
2004-10-22 16:28:36 -04:00
|
|
|
GSList *windows;
|
|
|
|
GSList *tmp;
|
2002-10-16 16:12:24 -04:00
|
|
|
|
2004-10-22 16:28:36 -04:00
|
|
|
/* Must operate on all windows on display instead of just on the
|
|
|
|
* active_workspace's window list, because the active_workspace's
|
|
|
|
* window list may not contain the on_all_workspace windows.
|
|
|
|
*/
|
2009-06-15 15:32:23 -04:00
|
|
|
windows = meta_display_list_windows (screen->display, META_LIST_DEFAULT);
|
2002-10-16 16:12:24 -04:00
|
|
|
|
|
|
|
tmp = windows;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *w = tmp->data;
|
|
|
|
|
|
|
|
if (w->screen == screen)
|
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
|
|
|
meta_window_queue (w, META_QUEUE_CALC_SHOWING);
|
2002-10-16 16:12:24 -04:00
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
2004-10-22 16:28:36 -04:00
|
|
|
|
|
|
|
g_slist_free (windows);
|
2002-10-16 16:12:24 -04:00
|
|
|
}
|
|
|
|
|
2003-05-16 17:59:08 -04:00
|
|
|
void
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 00:28:29 -04:00
|
|
|
meta_screen_minimize_all_on_active_workspace_except (MetaScreen *screen,
|
|
|
|
MetaWindow *keep)
|
2003-05-16 17:59:08 -04:00
|
|
|
{
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 00:28:29 -04:00
|
|
|
GList *windows;
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
windows = screen->active_workspace->windows;
|
2003-05-16 17:59:08 -04:00
|
|
|
|
|
|
|
tmp = windows;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *w = tmp->data;
|
|
|
|
|
|
|
|
if (w->screen == screen &&
|
|
|
|
w->has_minimize_func &&
|
|
|
|
w != keep)
|
|
|
|
meta_window_minimize (w);
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-16 16:12:24 -04:00
|
|
|
void
|
2004-12-19 21:46:42 -05:00
|
|
|
meta_screen_show_desktop (MetaScreen *screen,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 timestamp)
|
2002-10-16 16:12:24 -04:00
|
|
|
{
|
2004-12-19 21:46:42 -05:00
|
|
|
GList *windows;
|
|
|
|
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 00:28:29 -04:00
|
|
|
if (screen->active_workspace->showing_desktop)
|
2002-10-16 16:12:24 -04:00
|
|
|
return;
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 00:28:29 -04:00
|
|
|
|
|
|
|
screen->active_workspace->showing_desktop = TRUE;
|
|
|
|
|
2002-10-16 16:12:24 -04:00
|
|
|
queue_windows_showing (screen);
|
2004-12-19 21:46:42 -05:00
|
|
|
|
|
|
|
/* Focus the most recently used META_WINDOW_DESKTOP window, if there is one;
|
|
|
|
* see bug 159257.
|
|
|
|
*/
|
|
|
|
windows = screen->active_workspace->mru_list;
|
|
|
|
while (windows != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *w = windows->data;
|
|
|
|
|
|
|
|
if (w->screen == screen &&
|
|
|
|
w->type == META_WINDOW_DESKTOP)
|
|
|
|
{
|
|
|
|
meta_window_focus (w, timestamp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
windows = windows->next;
|
|
|
|
}
|
|
|
|
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 00:28:29 -04:00
|
|
|
|
|
|
|
meta_screen_update_showing_desktop_hint (screen);
|
2002-10-16 16:12:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_unshow_desktop (MetaScreen *screen)
|
|
|
|
{
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 00:28:29 -04:00
|
|
|
if (!screen->active_workspace->showing_desktop)
|
2002-10-16 16:12:24 -04:00
|
|
|
return;
|
|
|
|
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 00:28:29 -04:00
|
|
|
screen->active_workspace->showing_desktop = FALSE;
|
|
|
|
|
2002-10-16 16:12:24 -04:00
|
|
|
queue_windows_showing (screen);
|
|
|
|
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 00:28:29 -04:00
|
|
|
meta_screen_update_showing_desktop_hint (screen);
|
2002-10-16 16:12:24 -04:00
|
|
|
}
|
2002-10-25 19:35:50 -04:00
|
|
|
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 00:28:29 -04:00
|
|
|
|
2002-10-25 19:35:50 -04:00
|
|
|
#ifdef HAVE_STARTUP_NOTIFICATION
|
|
|
|
static gboolean startup_sequence_timeout (void *data);
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_startup_feedback (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
if (screen->startup_sequences != NULL)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Setting busy cursor\n");
|
|
|
|
meta_screen_set_cursor (screen, META_CURSOR_BUSY);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Setting default cursor\n");
|
|
|
|
meta_screen_set_cursor (screen, META_CURSOR_DEFAULT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
add_sequence (MetaScreen *screen,
|
|
|
|
SnStartupSequence *sequence)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Adding sequence %s\n",
|
|
|
|
sn_startup_sequence_get_id (sequence));
|
|
|
|
sn_startup_sequence_ref (sequence);
|
|
|
|
screen->startup_sequences = g_slist_prepend (screen->startup_sequences,
|
|
|
|
sequence);
|
|
|
|
|
|
|
|
/* our timeout just polls every second, instead of bothering
|
|
|
|
* to compute exactly when we may next time out
|
|
|
|
*/
|
|
|
|
if (screen->startup_sequence_timeout == 0)
|
2009-08-02 00:42:34 -04:00
|
|
|
screen->startup_sequence_timeout = g_timeout_add_seconds (1,
|
|
|
|
startup_sequence_timeout,
|
|
|
|
screen);
|
2002-10-25 19:35:50 -04:00
|
|
|
|
|
|
|
update_startup_feedback (screen);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
remove_sequence (MetaScreen *screen,
|
|
|
|
SnStartupSequence *sequence)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Removing sequence %s\n",
|
|
|
|
sn_startup_sequence_get_id (sequence));
|
|
|
|
|
|
|
|
screen->startup_sequences = g_slist_remove (screen->startup_sequences,
|
|
|
|
sequence);
|
2009-08-02 00:42:34 -04:00
|
|
|
|
2002-10-25 19:35:50 -04:00
|
|
|
if (screen->startup_sequences == NULL &&
|
|
|
|
screen->startup_sequence_timeout != 0)
|
|
|
|
{
|
|
|
|
g_source_remove (screen->startup_sequence_timeout);
|
|
|
|
screen->startup_sequence_timeout = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
update_startup_feedback (screen);
|
2009-08-02 00:42:34 -04:00
|
|
|
|
|
|
|
sn_startup_sequence_unref (sequence);
|
2002-10-25 19:35:50 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GSList *list;
|
|
|
|
GTimeVal now;
|
|
|
|
} CollectTimedOutData;
|
|
|
|
|
2002-11-30 22:58:04 -05:00
|
|
|
/* This should be fairly long, as it should never be required unless
|
|
|
|
* apps or .desktop files are buggy, and it's confusing if
|
|
|
|
* OpenOffice or whatever seems to stop launching - people
|
|
|
|
* might decide they need to launch it again.
|
|
|
|
*/
|
|
|
|
#define STARTUP_TIMEOUT 15000
|
2002-10-25 19:35:50 -04:00
|
|
|
|
|
|
|
static void
|
|
|
|
collect_timed_out_foreach (void *element,
|
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
CollectTimedOutData *ctod = data;
|
|
|
|
SnStartupSequence *sequence = element;
|
|
|
|
long tv_sec, tv_usec;
|
|
|
|
double elapsed;
|
|
|
|
|
|
|
|
sn_startup_sequence_get_last_active_time (sequence, &tv_sec, &tv_usec);
|
|
|
|
|
|
|
|
elapsed =
|
|
|
|
((((double)ctod->now.tv_sec - tv_sec) * G_USEC_PER_SEC +
|
|
|
|
(ctod->now.tv_usec - tv_usec))) / 1000.0;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Sequence used %g seconds vs. %g max: %s\n",
|
|
|
|
elapsed, (double) STARTUP_TIMEOUT,
|
|
|
|
sn_startup_sequence_get_id (sequence));
|
|
|
|
|
|
|
|
if (elapsed > STARTUP_TIMEOUT)
|
|
|
|
ctod->list = g_slist_prepend (ctod->list, sequence);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
startup_sequence_timeout (void *data)
|
|
|
|
{
|
|
|
|
MetaScreen *screen = data;
|
|
|
|
CollectTimedOutData ctod;
|
|
|
|
GSList *tmp;
|
|
|
|
|
|
|
|
ctod.list = NULL;
|
|
|
|
g_get_current_time (&ctod.now);
|
|
|
|
g_slist_foreach (screen->startup_sequences,
|
|
|
|
collect_timed_out_foreach,
|
|
|
|
&ctod);
|
|
|
|
|
|
|
|
tmp = ctod.list;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
SnStartupSequence *sequence = tmp->data;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Timed out sequence %s\n",
|
|
|
|
sn_startup_sequence_get_id (sequence));
|
|
|
|
|
2002-11-30 22:58:04 -05:00
|
|
|
sn_startup_sequence_complete (sequence);
|
2002-10-25 19:35:50 -04:00
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (ctod.list);
|
|
|
|
|
|
|
|
if (screen->startup_sequences != NULL)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* remove */
|
|
|
|
screen->startup_sequence_timeout = 0;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_screen_sn_event (SnMonitorEvent *event,
|
|
|
|
void *user_data)
|
|
|
|
{
|
|
|
|
MetaScreen *screen;
|
|
|
|
SnStartupSequence *sequence;
|
|
|
|
|
|
|
|
screen = user_data;
|
|
|
|
|
|
|
|
sequence = sn_monitor_event_get_startup_sequence (event);
|
2009-08-02 00:42:34 -04:00
|
|
|
|
|
|
|
sn_startup_sequence_ref (sequence);
|
|
|
|
|
2002-10-25 19:35:50 -04:00
|
|
|
switch (sn_monitor_event_get_type (event))
|
|
|
|
{
|
|
|
|
case SN_MONITOR_EVENT_INITIATED:
|
|
|
|
{
|
2003-01-22 20:53:18 -05:00
|
|
|
const char *wmclass;
|
|
|
|
|
|
|
|
wmclass = sn_startup_sequence_get_wmclass (sequence);
|
|
|
|
|
2002-10-25 19:35:50 -04:00
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
2003-01-22 20:53:18 -05:00
|
|
|
"Received startup initiated for %s wmclass %s\n",
|
|
|
|
sn_startup_sequence_get_id (sequence),
|
|
|
|
wmclass ? wmclass : "(unset)");
|
2002-10-25 19:35:50 -04:00
|
|
|
add_sequence (screen, sequence);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SN_MONITOR_EVENT_COMPLETED:
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Received startup completed for %s\n",
|
|
|
|
sn_startup_sequence_get_id (sequence));
|
|
|
|
remove_sequence (screen,
|
|
|
|
sn_monitor_event_get_startup_sequence (event));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SN_MONITOR_EVENT_CHANGED:
|
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Received startup changed for %s\n",
|
|
|
|
sn_startup_sequence_get_id (sequence));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SN_MONITOR_EVENT_CANCELED:
|
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Received startup canceled for %s\n",
|
|
|
|
sn_startup_sequence_get_id (sequence));
|
|
|
|
break;
|
|
|
|
}
|
2009-08-02 00:42:34 -04:00
|
|
|
|
|
|
|
g_signal_emit (G_OBJECT (screen), screen_signals[STARTUP_SEQUENCE_CHANGED], 0, sequence);
|
|
|
|
|
|
|
|
sn_startup_sequence_unref (sequence);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* meta_screen_get_startup_sequences:
|
|
|
|
* @screen:
|
|
|
|
*
|
|
|
|
* Return value: (transfer none): Currently active #SnStartupSequence items
|
|
|
|
*/
|
|
|
|
GSList *
|
|
|
|
meta_screen_get_startup_sequences (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
return screen->startup_sequences;
|
2002-10-25 19:35:50 -04:00
|
|
|
}
|
|
|
|
#endif
|
2002-11-30 22:58:04 -05:00
|
|
|
|
2007-06-17 22:37:14 -04:00
|
|
|
/* Sets the initial_timestamp and initial_workspace properties
|
|
|
|
* of a window according to information given us by the
|
|
|
|
* startup-notification library.
|
|
|
|
*
|
|
|
|
* Returns TRUE if startup properties have been applied, and
|
|
|
|
* FALSE if they have not (for example, if they had already
|
|
|
|
* been applied.)
|
|
|
|
*/
|
|
|
|
gboolean
|
2002-11-30 22:58:04 -05:00
|
|
|
meta_screen_apply_startup_properties (MetaScreen *screen,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_STARTUP_NOTIFICATION
|
|
|
|
const char *startup_id;
|
|
|
|
GSList *tmp;
|
|
|
|
SnStartupSequence *sequence;
|
|
|
|
|
2007-06-17 22:37:14 -04:00
|
|
|
/* Does the window have a startup ID stored? */
|
2002-11-30 22:58:04 -05:00
|
|
|
startup_id = meta_window_get_startup_id (window);
|
|
|
|
|
2003-01-22 20:53:18 -05:00
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Applying startup props to %s id \"%s\"\n",
|
|
|
|
window->desc,
|
|
|
|
startup_id ? startup_id : "(none)");
|
|
|
|
|
2002-11-30 22:58:04 -05:00
|
|
|
sequence = NULL;
|
2003-01-22 20:53:18 -05:00
|
|
|
if (startup_id == NULL)
|
2002-11-30 22:58:04 -05:00
|
|
|
{
|
2007-06-17 22:37:14 -04:00
|
|
|
/* No startup ID stored for the window. Let's ask the
|
|
|
|
* startup-notification library whether there's anything
|
|
|
|
* stored for the resource name or resource class hints.
|
|
|
|
*/
|
2003-01-22 20:53:18 -05:00
|
|
|
tmp = screen->startup_sequences;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
const char *wmclass;
|
2002-11-30 22:58:04 -05:00
|
|
|
|
2003-01-22 20:53:18 -05:00
|
|
|
wmclass = sn_startup_sequence_get_wmclass (tmp->data);
|
2002-11-30 22:58:04 -05:00
|
|
|
|
2003-01-22 20:53:18 -05:00
|
|
|
if (wmclass != NULL &&
|
|
|
|
((window->res_class &&
|
|
|
|
strcmp (wmclass, window->res_class) == 0) ||
|
|
|
|
(window->res_name &&
|
|
|
|
strcmp (wmclass, window->res_name) == 0)))
|
|
|
|
{
|
|
|
|
sequence = tmp->data;
|
|
|
|
|
|
|
|
g_assert (window->startup_id == NULL);
|
|
|
|
window->startup_id = g_strdup (sn_startup_sequence_get_id (sequence));
|
|
|
|
startup_id = window->startup_id;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Ending legacy sequence %s due to window %s\n",
|
|
|
|
sn_startup_sequence_get_id (sequence),
|
|
|
|
window->desc);
|
|
|
|
|
|
|
|
sn_startup_sequence_complete (sequence);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
2002-11-30 22:58:04 -05:00
|
|
|
}
|
2003-01-22 20:53:18 -05:00
|
|
|
}
|
2002-11-30 22:58:04 -05:00
|
|
|
|
2007-06-17 22:37:14 -04:00
|
|
|
/* Still no startup ID? Bail. */
|
2003-01-22 20:53:18 -05:00
|
|
|
if (startup_id == NULL)
|
2007-06-17 22:37:14 -04:00
|
|
|
return FALSE;
|
2003-01-22 20:53:18 -05:00
|
|
|
|
2007-06-17 22:37:14 -04:00
|
|
|
/* We might get this far and not know the sequence ID (if the window
|
|
|
|
* already had a startup ID stored), so let's look for one if we don't
|
|
|
|
* already know it.
|
|
|
|
*/
|
2003-01-22 20:53:18 -05:00
|
|
|
if (sequence == NULL)
|
|
|
|
{
|
|
|
|
tmp = screen->startup_sequences;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
const char *id;
|
|
|
|
|
|
|
|
id = sn_startup_sequence_get_id (tmp->data);
|
|
|
|
|
|
|
|
if (strcmp (id, startup_id) == 0)
|
|
|
|
{
|
|
|
|
sequence = tmp->data;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
2002-11-30 22:58:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (sequence != NULL)
|
|
|
|
{
|
2007-06-17 22:37:14 -04:00
|
|
|
gboolean changed_something = FALSE;
|
2002-11-30 22:58:04 -05:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Found startup sequence for window %s ID \"%s\"\n",
|
|
|
|
window->desc, startup_id);
|
|
|
|
|
|
|
|
if (!window->initial_workspace_set)
|
|
|
|
{
|
2007-06-17 22:37:14 -04:00
|
|
|
int space = sn_startup_sequence_get_workspace (sequence);
|
2002-11-30 22:58:04 -05:00
|
|
|
if (space >= 0)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Setting initial window workspace to %d based on startup info\n",
|
|
|
|
space);
|
|
|
|
|
|
|
|
window->initial_workspace_set = TRUE;
|
|
|
|
window->initial_workspace = space;
|
2007-06-17 22:37:14 -04:00
|
|
|
changed_something = TRUE;
|
2002-11-30 22:58:04 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
|
|
|
if (!window->initial_timestamp_set)
|
|
|
|
{
|
2007-06-17 22:37:14 -04:00
|
|
|
guint32 timestamp = sn_startup_sequence_get_timestamp (sequence);
|
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
"Setting initial window timestamp to %u based on startup info\n",
|
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
|
|
|
timestamp);
|
|
|
|
|
|
|
|
window->initial_timestamp_set = TRUE;
|
|
|
|
window->initial_timestamp = timestamp;
|
2007-06-17 22:37:14 -04:00
|
|
|
changed_something = TRUE;
|
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
|
|
|
}
|
|
|
|
|
2007-06-17 22:37:14 -04:00
|
|
|
return changed_something;
|
2002-11-30 22:58:04 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_STARTUP,
|
|
|
|
"Did not find startup sequence for window %s ID \"%s\"\n",
|
|
|
|
window->desc, startup_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* HAVE_STARTUP_NOTIFICATION */
|
2007-06-17 22:37:14 -04:00
|
|
|
|
|
|
|
return FALSE;
|
2002-11-30 22:58:04 -05:00
|
|
|
}
|
|
|
|
|
2008-05-18 20:00:09 -04:00
|
|
|
int
|
|
|
|
meta_screen_get_screen_number (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
return screen->number;
|
|
|
|
}
|
|
|
|
|
2008-12-02 18:13:11 -05:00
|
|
|
/**
|
|
|
|
* meta_screen_get_display:
|
|
|
|
* Retrieve the display associated with screen.
|
|
|
|
* @screen: A #MetaScreen
|
|
|
|
*
|
|
|
|
* Returns: (transfer none): Display
|
|
|
|
*/
|
2008-05-18 20:00:09 -04:00
|
|
|
MetaDisplay *
|
|
|
|
meta_screen_get_display (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
return screen->display;
|
|
|
|
}
|
|
|
|
|
|
|
|
Window
|
|
|
|
meta_screen_get_xroot (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
return screen->xroot;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_get_size (MetaScreen *screen,
|
|
|
|
int *width,
|
|
|
|
int *height)
|
|
|
|
{
|
|
|
|
*width = screen->rect.width;
|
|
|
|
*height = screen->rect.height;
|
|
|
|
}
|
|
|
|
|
|
|
|
gpointer
|
|
|
|
meta_screen_get_compositor_data (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
return screen->compositor_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_set_compositor_data (MetaScreen *screen,
|
|
|
|
gpointer compositor)
|
|
|
|
{
|
|
|
|
screen->compositor_data = 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-18 22:49:50 -05:00
|
|
|
void
|
|
|
|
meta_screen_set_cm_selection (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
char selection[32];
|
|
|
|
Atom a;
|
|
|
|
|
2010-01-05 17:29:06 -05:00
|
|
|
screen->wm_cm_timestamp = meta_display_get_current_time_roundtrip (
|
|
|
|
screen->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-18 22:49:50 -05:00
|
|
|
g_snprintf (selection, sizeof(selection), "_NET_WM_CM_S%d", screen->number);
|
|
|
|
meta_verbose ("Setting selection: %s\n", selection);
|
|
|
|
a = XInternAtom (screen->display->xdisplay, selection, FALSE);
|
|
|
|
XSetSelectionOwner (screen->display->xdisplay, a,
|
2010-01-05 17:29:06 -05:00
|
|
|
screen->wm_cm_selection_window, screen->wm_cm_timestamp);
|
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-18 22:49:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_unset_cm_selection (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
char selection[32];
|
|
|
|
Atom a;
|
|
|
|
|
|
|
|
g_snprintf (selection, sizeof(selection), "_NET_WM_CM_S%d", screen->number);
|
|
|
|
a = XInternAtom (screen->display->xdisplay, selection, FALSE);
|
2010-01-05 17:29:06 -05:00
|
|
|
XSetSelectionOwner (screen->display->xdisplay, a,
|
|
|
|
None, screen->wm_cm_timestamp);
|
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-18 22:49:50 -05:00
|
|
|
}
|
2008-09-18 11:09:11 -04:00
|
|
|
|
|
|
|
GList *
|
|
|
|
meta_screen_get_workspaces (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
return screen->workspaces;
|
|
|
|
}
|
|
|
|
|
2008-11-03 07:32:25 -05:00
|
|
|
int
|
|
|
|
meta_screen_get_active_workspace_index (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
MetaWorkspace *active = screen->active_workspace;
|
|
|
|
|
|
|
|
if (!active)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return meta_workspace_index (active);
|
|
|
|
}
|
2008-11-20 07:41:28 -05:00
|
|
|
|
2009-09-03 20:57:01 -04:00
|
|
|
/**
|
|
|
|
* meta_screen_get_active_workspace:
|
|
|
|
*
|
|
|
|
* Returns: (transfer none): The current workspace
|
|
|
|
*/
|
2008-11-20 07:41:28 -05:00
|
|
|
MetaWorkspace *
|
|
|
|
meta_screen_get_active_workspace (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
return screen->active_workspace;
|
|
|
|
}
|
2009-03-12 17:07:27 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_restacked (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
g_signal_emit (screen, screen_signals[RESTACKED], 0);
|
|
|
|
}
|
2009-07-02 11:19:02 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_workspace_switched (MetaScreen *screen,
|
|
|
|
int from,
|
|
|
|
int to,
|
|
|
|
MetaMotionDirection direction)
|
|
|
|
{
|
|
|
|
g_signal_emit (screen, screen_signals[WORKSPACE_SWITCHED], 0,
|
|
|
|
from, to, direction);
|
|
|
|
}
|
|
|
|
|