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 Session Management */
|
2001-06-09 17:58:30 -04:00
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
/*
|
2001-06-22 02:21:44 -04:00
|
|
|
* Copyright (C) 2001 Havoc Pennington (some code in here from
|
|
|
|
* libgnomeui, (C) Tom Tromey, Carsten Schaar)
|
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
|
|
|
* Copyright (C) 2004, 2005 Elijah Newren
|
2014-05-02 09:34:02 -04:00
|
|
|
*
|
2001-06-09 17:58:30 -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.
|
2014-05-02 09:34:02 -04:00
|
|
|
*
|
2001-06-09 17:58:30 -04:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-11 20:42:06 -05:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2002-03-13 23:09:42 -05:00
|
|
|
*/
|
2001-06-09 17:58:30 -04:00
|
|
|
|
2018-07-10 04:36:24 -04:00
|
|
|
#include "config.h"
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2018-07-10 04:36:24 -04:00
|
|
|
#include "x11/session.h"
|
2001-06-09 17:58:30 -04:00
|
|
|
|
2009-11-19 17:38:06 -05:00
|
|
|
#include <sys/wait.h>
|
2018-07-10 04:36:24 -04:00
|
|
|
#include <time.h>
|
|
|
|
#include <X11/Xatom.h>
|
|
|
|
|
|
|
|
#include "core/util-private.h"
|
2021-03-03 11:23:44 -05:00
|
|
|
#include "meta/meta-context.h"
|
2018-07-10 04:36:24 -04:00
|
|
|
#include "x11/meta-x11-display-private.h"
|
2002-03-13 23:09:42 -05:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
#ifndef HAVE_SM
|
|
|
|
void
|
2021-03-03 11:23:44 -05:00
|
|
|
meta_session_init (MetaContext *context,
|
|
|
|
const char *client_id,
|
|
|
|
const char *save_file)
|
2001-06-22 02:21:44 -04:00
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Compiled without session management support");
|
2001-06-22 02:21:44 -04:00
|
|
|
}
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
|
|
const MetaWindowSessionInfo*
|
|
|
|
meta_window_lookup_saved_state (MetaWindow *window)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_window_release_saved_state (const MetaWindowSessionInfo *info)
|
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
2001-06-22 02:21:44 -04:00
|
|
|
#else /* HAVE_SM */
|
2001-06-09 17:58:30 -04:00
|
|
|
|
2001-07-26 01:10:01 -04:00
|
|
|
#include <errno.h>
|
2018-07-10 04:36:24 -04:00
|
|
|
#include <fcntl.h>
|
2001-06-22 02:21:44 -04:00
|
|
|
#include <glib.h>
|
|
|
|
#include <stdio.h>
|
2018-07-10 04:36:24 -04:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <X11/ICE/ICElib.h>
|
|
|
|
#include <X11/SM/SMlib.h>
|
|
|
|
|
|
|
|
#include "core/display-private.h"
|
|
|
|
#include "meta/main.h"
|
|
|
|
#include "meta/util.h"
|
|
|
|
#include "meta/workspace.h"
|
2001-06-09 17:58:30 -04:00
|
|
|
|
2021-03-03 11:23:44 -05:00
|
|
|
typedef struct _MetaIceConnection
|
|
|
|
{
|
|
|
|
IceConn ice_connection;
|
|
|
|
MetaContext *context;
|
|
|
|
} MetaIceConnection;
|
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
static void ice_io_error_handler (IceConn connection);
|
2001-06-09 17:58:30 -04:00
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
static void new_ice_connection (IceConn connection, IcePointer client_data,
|
2001-06-22 02:21:44 -04:00
|
|
|
Bool opening, IcePointer *watch_data);
|
2001-06-09 17:58:30 -04:00
|
|
|
|
2002-03-13 23:09:42 -05:00
|
|
|
static void save_state (void);
|
2002-03-13 23:36:02 -05:00
|
|
|
static char* load_state (const char *previous_save_file);
|
2002-03-13 23:09:42 -05:00
|
|
|
static void regenerate_save_file (void);
|
|
|
|
static const char* full_save_file (void);
|
2002-07-12 23:40:05 -04:00
|
|
|
static void warn_about_lame_clients_and_finish_interact (gboolean shutdown);
|
2009-12-17 16:20:18 -05:00
|
|
|
static void disconnect (void);
|
2001-07-26 01:10:01 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
/* This is called when data is available on an ICE connection. */
|
|
|
|
static gboolean
|
2021-03-03 11:23:44 -05:00
|
|
|
process_ice_messages (GIOChannel *channel,
|
|
|
|
GIOCondition condition,
|
|
|
|
gpointer user_data)
|
2001-06-22 02:21:44 -04:00
|
|
|
{
|
2021-03-03 11:23:44 -05:00
|
|
|
MetaIceConnection *ice_connection = user_data;
|
|
|
|
IceConn connection = ice_connection->ice_connection;
|
2001-06-22 02:21:44 -04:00
|
|
|
IceProcessMessagesStatus status;
|
|
|
|
|
2001-07-12 01:53:56 -04:00
|
|
|
/* This blocks infinitely sometimes. I don't know what
|
|
|
|
* to do about it. Checking "condition" just breaks
|
|
|
|
* session management.
|
|
|
|
*/
|
2001-06-22 02:21:44 -04:00
|
|
|
status = IceProcessMessages (connection, NULL, NULL);
|
|
|
|
|
|
|
|
if (status == IceProcessMessagesIOError)
|
|
|
|
{
|
2009-12-17 16:20:18 -05:00
|
|
|
/* We were disconnected; close our connection to the
|
|
|
|
* session manager, this will result in the ICE connection
|
|
|
|
* being cleaned up, since it is owned by libSM.
|
|
|
|
*/
|
|
|
|
disconnect ();
|
2021-03-03 11:23:44 -05:00
|
|
|
meta_context_terminate (ice_connection->context);
|
2001-06-22 02:21:44 -04:00
|
|
|
|
2001-09-17 00:11:25 -04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This is called when a new ICE connection is made. It arranges for
|
|
|
|
the ICE connection to be handled via the event loop. */
|
|
|
|
static void
|
|
|
|
new_ice_connection (IceConn connection, IcePointer client_data, Bool opening,
|
|
|
|
IcePointer *watch_data)
|
|
|
|
{
|
2021-03-03 11:23:44 -05:00
|
|
|
MetaContext *context = client_data;
|
2001-06-22 02:21:44 -04:00
|
|
|
guint input_id;
|
|
|
|
|
|
|
|
if (opening)
|
|
|
|
{
|
2021-03-03 11:23:44 -05:00
|
|
|
MetaIceConnection *ice_connection;
|
2001-06-22 02:21:44 -04:00
|
|
|
GIOChannel *channel;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-09-15 20:30:45 -04:00
|
|
|
fcntl (IceConnectionNumber (connection), F_SETFD,
|
|
|
|
fcntl (IceConnectionNumber (connection), F_GETFD, 0) | FD_CLOEXEC);
|
2001-06-22 02:21:44 -04:00
|
|
|
|
2021-03-03 11:23:44 -05:00
|
|
|
ice_connection = g_new0 (MetaIceConnection, 1);
|
|
|
|
ice_connection->ice_connection = connection;
|
|
|
|
ice_connection->context = context;
|
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
channel = g_io_channel_unix_new (IceConnectionNumber (connection));
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2021-03-03 11:23:44 -05:00
|
|
|
input_id = g_io_add_watch_full (channel,
|
|
|
|
G_PRIORITY_DEFAULT,
|
|
|
|
G_IO_IN | G_IO_ERR,
|
|
|
|
process_ice_messages,
|
|
|
|
ice_connection,
|
|
|
|
g_free);
|
2001-06-22 02:21:44 -04:00
|
|
|
|
|
|
|
g_io_channel_unref (channel);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
*watch_data = (IcePointer) GUINT_TO_POINTER (input_id);
|
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
else
|
2001-06-22 02:21:44 -04:00
|
|
|
{
|
|
|
|
input_id = GPOINTER_TO_UINT ((gpointer) *watch_data);
|
|
|
|
|
2019-11-21 18:25:30 -05:00
|
|
|
g_clear_handle_id (&input_id, g_source_remove);
|
2001-06-22 02:21:44 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-09-15 20:30:45 -04:00
|
|
|
static IceIOErrorHandler ice_installed_handler;
|
2001-06-22 02:21:44 -04:00
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
/* We call any handler installed before (or after) gnome_ice_init but
|
2001-06-22 02:21:44 -04:00
|
|
|
avoid calling the default libICE handler which does an exit() */
|
|
|
|
static void
|
|
|
|
ice_io_error_handler (IceConn connection)
|
|
|
|
{
|
2001-09-15 20:30:45 -04:00
|
|
|
if (ice_installed_handler)
|
|
|
|
(*ice_installed_handler) (connection);
|
2014-05-02 09:34:02 -04:00
|
|
|
}
|
2001-06-22 02:21:44 -04:00
|
|
|
|
|
|
|
static void
|
|
|
|
ice_init (void)
|
|
|
|
{
|
|
|
|
static gboolean ice_initted = FALSE;
|
|
|
|
|
|
|
|
if (! ice_initted)
|
|
|
|
{
|
|
|
|
IceIOErrorHandler default_handler;
|
|
|
|
|
2001-09-15 20:30:45 -04:00
|
|
|
ice_installed_handler = IceSetIOErrorHandler (NULL);
|
2001-06-22 02:21:44 -04:00
|
|
|
default_handler = IceSetIOErrorHandler (ice_io_error_handler);
|
|
|
|
|
2001-09-15 20:30:45 -04:00
|
|
|
if (ice_installed_handler == default_handler)
|
|
|
|
ice_installed_handler = NULL;
|
2001-06-22 02:21:44 -04:00
|
|
|
|
|
|
|
IceAddConnectionWatch (new_ice_connection, NULL);
|
|
|
|
|
|
|
|
ice_initted = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
STATE_DISCONNECTED,
|
|
|
|
STATE_IDLE,
|
|
|
|
STATE_SAVING_PHASE_1,
|
|
|
|
STATE_WAITING_FOR_PHASE_2,
|
|
|
|
STATE_SAVING_PHASE_2,
|
2002-05-29 23:54:10 -04:00
|
|
|
STATE_WAITING_FOR_INTERACT,
|
|
|
|
STATE_DONE_WITH_INTERACT,
|
2002-07-31 21:49:08 -04:00
|
|
|
STATE_SKIPPING_GLOBAL_SAVE,
|
2001-06-22 02:21:44 -04:00
|
|
|
STATE_FROZEN,
|
|
|
|
STATE_REGISTERING
|
|
|
|
} ClientState;
|
|
|
|
|
|
|
|
static void save_phase_2_callback (SmcConn smc_conn,
|
|
|
|
SmPointer client_data);
|
|
|
|
static void interact_callback (SmcConn smc_conn,
|
|
|
|
SmPointer client_data);
|
|
|
|
static void shutdown_cancelled_callback (SmcConn smc_conn,
|
|
|
|
SmPointer client_data);
|
|
|
|
static void save_complete_callback (SmcConn smc_conn,
|
|
|
|
SmPointer client_data);
|
|
|
|
static void die_callback (SmcConn smc_conn,
|
|
|
|
SmPointer client_data);
|
|
|
|
static void save_yourself_callback (SmcConn smc_conn,
|
|
|
|
SmPointer client_data,
|
|
|
|
int save_style,
|
|
|
|
Bool shutdown,
|
|
|
|
int interact_style,
|
|
|
|
Bool fast);
|
|
|
|
static void set_clone_restart_commands (void);
|
|
|
|
|
2002-03-13 23:09:42 -05:00
|
|
|
static char *client_id = NULL;
|
2001-06-22 02:21:44 -04:00
|
|
|
static gpointer session_connection = NULL;
|
|
|
|
static ClientState current_state = STATE_DISCONNECTED;
|
2002-05-29 23:54:10 -04:00
|
|
|
static gboolean interaction_allowed = FALSE;
|
2001-06-22 02:21:44 -04:00
|
|
|
|
|
|
|
void
|
2021-03-03 11:23:44 -05:00
|
|
|
meta_session_init (MetaContext *context,
|
|
|
|
const char *previous_client_id,
|
|
|
|
const char *previous_save_file)
|
2001-06-22 02:21:44 -04:00
|
|
|
{
|
|
|
|
/* Some code here from twm */
|
|
|
|
char buf[256];
|
|
|
|
unsigned long mask;
|
|
|
|
SmcCallbacks callbacks;
|
2002-03-13 23:36:02 -05:00
|
|
|
char *saved_client_id;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2021-02-24 05:24:42 -05:00
|
|
|
if (!previous_client_id)
|
|
|
|
{
|
|
|
|
const char *desktop_autostart_id;
|
|
|
|
|
|
|
|
desktop_autostart_id = g_getenv ("DESKTOP_AUTOSTART_ID");
|
|
|
|
if (desktop_autostart_id)
|
|
|
|
previous_client_id = desktop_autostart_id;
|
|
|
|
}
|
|
|
|
g_unsetenv ("DESKTOP_AUTOSTART_ID");
|
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Initializing session with save file '%s'",
|
2002-03-13 23:09:42 -05:00
|
|
|
previous_save_file ? previous_save_file : "(none)");
|
2001-06-22 02:21:44 -04:00
|
|
|
|
2002-03-13 23:09:42 -05:00
|
|
|
if (previous_save_file)
|
2002-03-13 23:36:02 -05:00
|
|
|
{
|
|
|
|
saved_client_id = load_state (previous_save_file);
|
|
|
|
previous_client_id = saved_client_id;
|
|
|
|
}
|
2007-03-26 17:38:19 -04:00
|
|
|
else if (previous_client_id)
|
|
|
|
{
|
|
|
|
char *save_file = g_strconcat (previous_client_id, ".ms", NULL);
|
|
|
|
saved_client_id = load_state (save_file);
|
|
|
|
g_free (save_file);
|
|
|
|
}
|
2002-03-13 23:36:02 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
saved_client_id = NULL;
|
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
ice_init ();
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
mask = SmcSaveYourselfProcMask | SmcDieProcMask |
|
|
|
|
SmcSaveCompleteProcMask | SmcShutdownCancelledProcMask;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
callbacks.save_yourself.callback = save_yourself_callback;
|
2021-03-03 11:23:44 -05:00
|
|
|
callbacks.save_yourself.client_data = context;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
callbacks.die.callback = die_callback;
|
2021-03-03 11:23:44 -05:00
|
|
|
callbacks.die.client_data = context;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
callbacks.save_complete.callback = save_complete_callback;
|
2021-03-03 11:23:44 -05:00
|
|
|
callbacks.save_complete.client_data = context;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
callbacks.shutdown_cancelled.callback = shutdown_cancelled_callback;
|
2021-03-03 11:23:44 -05:00
|
|
|
callbacks.shutdown_cancelled.client_data = context;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
session_connection =
|
|
|
|
SmcOpenConnection (NULL, /* use SESSION_MANAGER env */
|
|
|
|
NULL, /* means use existing ICE connection */
|
|
|
|
SmProtoMajor,
|
|
|
|
SmProtoMinor,
|
|
|
|
mask,
|
|
|
|
&callbacks,
|
2002-03-13 23:36:02 -05:00
|
|
|
(char*) previous_client_id,
|
2001-06-22 02:21:44 -04:00
|
|
|
&client_id,
|
|
|
|
255, buf);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
if (session_connection == NULL)
|
|
|
|
{
|
2014-05-02 09:34:02 -04:00
|
|
|
meta_topic (META_DEBUG_SM,
|
2020-10-02 11:47:22 -04:00
|
|
|
"Failed to a open connection to a session manager, so window positions will not be saved: %s",
|
2004-06-24 13:02:54 -04:00
|
|
|
buf);
|
2002-03-13 23:36:02 -05:00
|
|
|
|
|
|
|
goto out;
|
2001-06-22 02:21:44 -04:00
|
|
|
}
|
|
|
|
else
|
2001-07-26 01:10:01 -04:00
|
|
|
{
|
|
|
|
if (client_id == NULL)
|
|
|
|
meta_bug ("Session manager gave us a NULL client ID?");
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Obtained session ID '%s'", client_id);
|
2001-07-26 01:10:01 -04:00
|
|
|
}
|
2001-06-22 02:21:44 -04:00
|
|
|
|
2002-03-13 23:36:02 -05:00
|
|
|
if (previous_client_id && strcmp (previous_client_id, client_id) == 0)
|
2001-06-22 02:21:44 -04:00
|
|
|
current_state = STATE_IDLE;
|
|
|
|
else
|
|
|
|
current_state = STATE_REGISTERING;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
{
|
2001-10-12 00:52:53 -04:00
|
|
|
SmProp prop1, prop2, prop3, prop4, prop5, prop6, *props[6];
|
|
|
|
SmPropValue prop1val, prop2val, prop3val, prop4val, prop5val, prop6val;
|
2001-06-22 02:21:44 -04:00
|
|
|
char pid[32];
|
2011-03-10 17:58:44 -05:00
|
|
|
/* Historically, this was SmRestartImmediately, which made sense
|
|
|
|
* for a stateless window manager, but we don't really control
|
|
|
|
* what embedders do, and it's all around better if gnome-session
|
|
|
|
* handles this.
|
|
|
|
*/
|
|
|
|
char hint = SmRestartIfRunning;
|
2001-10-12 00:52:53 -04:00
|
|
|
char priority = 20; /* low to run before other apps */
|
2011-04-29 07:23:30 -04:00
|
|
|
const char *prgname;
|
|
|
|
|
|
|
|
prgname = g_get_prgname ();
|
|
|
|
|
2015-09-23 19:13:59 -04:00
|
|
|
prop1.name = (char *)SmProgram;
|
|
|
|
prop1.type = (char *)SmARRAY8;
|
2001-06-22 02:21:44 -04:00
|
|
|
prop1.num_vals = 1;
|
|
|
|
prop1.vals = &prop1val;
|
2011-04-29 07:23:30 -04:00
|
|
|
prop1val.value = (char *)prgname;
|
|
|
|
prop1val.length = strlen (prgname);
|
2001-06-22 02:21:44 -04:00
|
|
|
|
|
|
|
/* twm sets getuid() for this, but the SM spec plainly
|
|
|
|
* says pw_name, twm is on crack
|
|
|
|
*/
|
2015-09-23 19:13:59 -04:00
|
|
|
prop2.name = (char *)SmUserID;
|
|
|
|
prop2.type = (char *)SmARRAY8;
|
2001-06-22 02:21:44 -04:00
|
|
|
prop2.num_vals = 1;
|
|
|
|
prop2.vals = &prop2val;
|
2002-03-13 23:09:42 -05:00
|
|
|
prop2val.value = (char*) g_get_user_name ();
|
2001-06-22 02:21:44 -04:00
|
|
|
prop2val.length = strlen (prop2val.value);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2015-09-23 19:13:59 -04:00
|
|
|
prop3.name = (char *)SmRestartStyleHint;
|
|
|
|
prop3.type = (char *)SmCARD8;
|
2001-06-22 02:21:44 -04:00
|
|
|
prop3.num_vals = 1;
|
|
|
|
prop3.vals = &prop3val;
|
|
|
|
prop3val.value = &hint;
|
|
|
|
prop3val.length = 1;
|
|
|
|
|
|
|
|
sprintf (pid, "%d", getpid ());
|
2015-09-23 19:13:59 -04:00
|
|
|
prop4.name = (char *)SmProcessID;
|
|
|
|
prop4.type = (char *)SmARRAY8;
|
2001-06-22 02:21:44 -04:00
|
|
|
prop4.num_vals = 1;
|
|
|
|
prop4.vals = &prop4val;
|
|
|
|
prop4val.value = pid;
|
2014-05-02 09:34:02 -04:00
|
|
|
prop4val.length = strlen (prop4val.value);
|
2001-06-22 02:21:44 -04:00
|
|
|
|
|
|
|
/* Always start in home directory */
|
2015-09-23 19:13:59 -04:00
|
|
|
prop5.name = (char *)SmCurrentDirectory;
|
|
|
|
prop5.type = (char *)SmARRAY8;
|
2001-06-22 02:21:44 -04:00
|
|
|
prop5.num_vals = 1;
|
|
|
|
prop5.vals = &prop5val;
|
2002-03-13 23:09:42 -05:00
|
|
|
prop5val.value = (char*) g_get_home_dir ();
|
2001-06-22 02:21:44 -04:00
|
|
|
prop5val.length = strlen (prop5val.value);
|
2001-10-12 00:52:53 -04:00
|
|
|
|
2015-09-23 19:13:59 -04:00
|
|
|
prop6.name = (char *)"_GSM_Priority";
|
|
|
|
prop6.type = (char *)SmCARD8;
|
2001-10-12 00:52:53 -04:00
|
|
|
prop6.num_vals = 1;
|
|
|
|
prop6.vals = &prop6val;
|
|
|
|
prop6val.value = &priority;
|
|
|
|
prop6val.length = 1;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
props[0] = &prop1;
|
|
|
|
props[1] = &prop2;
|
|
|
|
props[2] = &prop3;
|
|
|
|
props[3] = &prop4;
|
|
|
|
props[4] = &prop5;
|
2001-10-12 00:52:53 -04:00
|
|
|
props[5] = &prop6;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-10-12 00:52:53 -04:00
|
|
|
SmcSetProperties (session_connection, 6, props);
|
2001-06-22 02:21:44 -04:00
|
|
|
}
|
2002-03-13 23:36:02 -05:00
|
|
|
|
|
|
|
out:
|
|
|
|
g_free (saved_client_id);
|
2001-06-22 02:21:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
disconnect (void)
|
|
|
|
{
|
|
|
|
SmcCloseConnection (session_connection, 0, NULL);
|
|
|
|
session_connection = NULL;
|
|
|
|
current_state = STATE_DISCONNECTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
save_yourself_possibly_done (gboolean shutdown,
|
|
|
|
gboolean successful)
|
|
|
|
{
|
2002-06-01 11:46:04 -04:00
|
|
|
meta_topic (META_DEBUG_SM,
|
2020-10-02 11:47:22 -04:00
|
|
|
"save possibly done shutdown = %d success = %d",
|
2002-06-01 11:46:04 -04:00
|
|
|
shutdown, successful);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
if (current_state == STATE_SAVING_PHASE_1)
|
|
|
|
{
|
|
|
|
Status status;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
status = SmcRequestSaveYourselfPhase2 (session_connection,
|
|
|
|
save_phase_2_callback,
|
|
|
|
GINT_TO_POINTER (shutdown));
|
|
|
|
|
|
|
|
if (status)
|
|
|
|
current_state = STATE_WAITING_FOR_PHASE_2;
|
2002-06-01 11:46:04 -04:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_SM,
|
2020-10-02 11:47:22 -04:00
|
|
|
"Requested phase 2, status = %d", status);
|
2001-06-22 02:21:44 -04:00
|
|
|
}
|
|
|
|
|
2002-05-29 23:54:10 -04:00
|
|
|
if (current_state == STATE_SAVING_PHASE_2 &&
|
|
|
|
interaction_allowed)
|
|
|
|
{
|
|
|
|
Status status;
|
|
|
|
|
|
|
|
status = SmcInteractRequest (session_connection,
|
|
|
|
/* ignore this feature of the protocol by always
|
|
|
|
* claiming normal
|
|
|
|
*/
|
|
|
|
SmDialogNormal,
|
|
|
|
interact_callback,
|
|
|
|
GINT_TO_POINTER (shutdown));
|
|
|
|
|
|
|
|
if (status)
|
|
|
|
current_state = STATE_WAITING_FOR_INTERACT;
|
2002-06-01 11:46:04 -04:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_SM,
|
2020-10-02 11:47:22 -04:00
|
|
|
"Requested interact, status = %d", status);
|
2002-05-29 23:54:10 -04:00
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
if (current_state == STATE_SAVING_PHASE_1 ||
|
2002-05-29 23:54:10 -04:00
|
|
|
current_state == STATE_SAVING_PHASE_2 ||
|
2002-07-31 21:49:08 -04:00
|
|
|
current_state == STATE_DONE_WITH_INTERACT ||
|
|
|
|
current_state == STATE_SKIPPING_GLOBAL_SAVE)
|
2001-06-22 02:21:44 -04:00
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Sending SaveYourselfDone");
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
SmcSaveYourselfDone (session_connection,
|
|
|
|
successful);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
if (shutdown)
|
|
|
|
current_state = STATE_FROZEN;
|
|
|
|
else
|
|
|
|
current_state = STATE_IDLE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
static void
|
2001-06-22 02:21:44 -04:00
|
|
|
save_phase_2_callback (SmcConn smc_conn, SmPointer client_data)
|
|
|
|
{
|
|
|
|
gboolean shutdown;
|
|
|
|
|
2002-06-01 11:46:04 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Phase 2 save");
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
shutdown = GPOINTER_TO_INT (client_data);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
current_state = STATE_SAVING_PHASE_2;
|
|
|
|
|
2001-07-26 01:10:01 -04:00
|
|
|
save_state ();
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
save_yourself_possibly_done (shutdown, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
save_yourself_callback (SmcConn smc_conn,
|
|
|
|
SmPointer client_data,
|
|
|
|
int save_style,
|
|
|
|
Bool shutdown,
|
|
|
|
int interact_style,
|
|
|
|
Bool fast)
|
|
|
|
{
|
|
|
|
gboolean successful;
|
|
|
|
|
2002-06-01 11:46:04 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "SaveYourself received");
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
successful = TRUE;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
/* The first SaveYourself after registering for the first time
|
|
|
|
* is a special case (SM specs 7.2).
|
|
|
|
*/
|
|
|
|
|
2002-03-13 23:09:42 -05:00
|
|
|
#if 0 /* I think the GnomeClient rationale for this doesn't apply */
|
2001-06-22 02:21:44 -04:00
|
|
|
if (current_state == STATE_REGISTERING)
|
|
|
|
{
|
|
|
|
current_state = STATE_IDLE;
|
|
|
|
/* Double check that this is a section 7.2 SaveYourself: */
|
2014-05-02 09:34:02 -04:00
|
|
|
|
|
|
|
if (save_style == SmSaveLocal &&
|
2001-06-22 02:21:44 -04:00
|
|
|
interact_style == SmInteractStyleNone &&
|
|
|
|
!shutdown && !fast)
|
|
|
|
{
|
|
|
|
/* The protocol requires this even if xsm ignores it. */
|
|
|
|
SmcSaveYourselfDone (session_connection, successful);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2002-03-13 23:09:42 -05:00
|
|
|
#endif
|
2001-06-22 02:21:44 -04:00
|
|
|
|
2002-07-31 21:49:08 -04:00
|
|
|
/* ignore Global style saves
|
2014-05-02 09:34:02 -04:00
|
|
|
*
|
2002-07-31 21:49:08 -04:00
|
|
|
* This interpretaion of the Local/Global/Both styles
|
|
|
|
* was discussed extensively on the xdg-list. See:
|
|
|
|
*
|
|
|
|
* https://listman.redhat.com/pipermail/xdg-list/2002-July/000615.html
|
|
|
|
*/
|
|
|
|
if (save_style == SmSaveGlobal)
|
|
|
|
{
|
|
|
|
current_state = STATE_SKIPPING_GLOBAL_SAVE;
|
|
|
|
save_yourself_possibly_done (shutdown, successful);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-05-29 23:54:10 -04:00
|
|
|
interaction_allowed = interact_style != SmInteractStyleNone;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
current_state = STATE_SAVING_PHASE_1;
|
|
|
|
|
2002-03-13 23:09:42 -05:00
|
|
|
regenerate_save_file ();
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
set_clone_restart_commands ();
|
|
|
|
|
|
|
|
save_yourself_possibly_done (shutdown, successful);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
die_callback (SmcConn smc_conn, SmPointer client_data)
|
|
|
|
{
|
2021-03-03 11:23:44 -05:00
|
|
|
MetaContext *context = client_data;
|
|
|
|
|
2011-02-26 17:01:21 -05:00
|
|
|
meta_topic (META_DEBUG_SM, "Disconnecting from session manager");
|
2021-03-03 11:23:44 -05:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
disconnect ();
|
2011-02-26 17:01:21 -05:00
|
|
|
/* We don't actually exit here - we will simply go away with the X
|
|
|
|
* server on logout, when we lose the X connection and libx11 kills
|
|
|
|
* us. It looks like *crap* on logout if the user sees their
|
|
|
|
* windows lose the decorations, etc.
|
|
|
|
*
|
|
|
|
* Anything that wants us to go away outside of session management
|
|
|
|
* can use kill().
|
|
|
|
*/
|
2013-08-21 09:59:16 -04:00
|
|
|
|
|
|
|
/* All of that is true - unless we're a wayland compositor. In which
|
|
|
|
* case the X server won't go down until we do, so we must die first.
|
|
|
|
*/
|
|
|
|
if (meta_is_wayland_compositor ())
|
2021-03-03 11:23:44 -05:00
|
|
|
meta_context_terminate (context);
|
2001-06-22 02:21:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
save_complete_callback (SmcConn smc_conn, SmPointer client_data)
|
|
|
|
{
|
|
|
|
/* nothing */
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "SaveComplete received");
|
2001-06-22 02:21:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
shutdown_cancelled_callback (SmcConn smc_conn, SmPointer client_data)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Shutdown cancelled received");
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-05-29 23:54:10 -04:00
|
|
|
if (session_connection != NULL &&
|
|
|
|
(current_state != STATE_IDLE && current_state != STATE_FROZEN))
|
|
|
|
{
|
|
|
|
SmcSaveYourselfDone (session_connection, True);
|
|
|
|
current_state = STATE_IDLE;
|
|
|
|
}
|
2001-06-22 02:21:44 -04:00
|
|
|
}
|
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
static void
|
2001-06-22 02:21:44 -04:00
|
|
|
interact_callback (SmcConn smc_conn, SmPointer client_data)
|
|
|
|
{
|
|
|
|
/* nothing */
|
2002-05-29 23:54:10 -04:00
|
|
|
gboolean shutdown;
|
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Interaction permission received");
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-05-29 23:54:10 -04:00
|
|
|
shutdown = GPOINTER_TO_INT (client_data);
|
|
|
|
|
|
|
|
current_state = STATE_DONE_WITH_INTERACT;
|
|
|
|
|
2002-07-12 23:40:05 -04:00
|
|
|
warn_about_lame_clients_and_finish_interact (shutdown);
|
2001-06-22 02:21:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_clone_restart_commands (void)
|
|
|
|
{
|
|
|
|
char *restartv[10];
|
|
|
|
char *clonev[10];
|
2001-07-26 01:10:01 -04:00
|
|
|
char *discardv[10];
|
2001-06-22 02:21:44 -04:00
|
|
|
int i;
|
2001-07-26 01:10:01 -04:00
|
|
|
SmProp prop1, prop2, prop3, *props[3];
|
2011-04-29 07:23:30 -04:00
|
|
|
const char *prgname;
|
|
|
|
|
|
|
|
prgname = g_get_prgname ();
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
/* Restart (use same client ID) */
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2015-09-23 19:13:59 -04:00
|
|
|
prop1.name = (char *)SmRestartCommand;
|
|
|
|
prop1.type = (char *)SmLISTofARRAY8;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2007-03-26 17:38:19 -04:00
|
|
|
g_return_if_fail (client_id);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
i = 0;
|
2011-04-29 07:23:30 -04:00
|
|
|
restartv[i] = (char *)prgname;
|
2001-06-22 02:21:44 -04:00
|
|
|
++i;
|
2015-09-23 19:13:59 -04:00
|
|
|
restartv[i] = (char *)"--sm-client-id";
|
2001-06-22 02:21:44 -04:00
|
|
|
++i;
|
2007-03-26 17:38:19 -04:00
|
|
|
restartv[i] = client_id;
|
2001-06-22 02:21:44 -04:00
|
|
|
++i;
|
|
|
|
restartv[i] = NULL;
|
|
|
|
|
|
|
|
prop1.vals = g_new (SmPropValue, i);
|
|
|
|
i = 0;
|
|
|
|
while (restartv[i])
|
|
|
|
{
|
|
|
|
prop1.vals[i].value = restartv[i];
|
|
|
|
prop1.vals[i].length = strlen (restartv[i]);
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
prop1.num_vals = i;
|
|
|
|
|
|
|
|
/* Clone (no client ID) */
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
i = 0;
|
2011-04-29 07:23:30 -04:00
|
|
|
clonev[i] = (char *)prgname;
|
2001-06-22 02:21:44 -04:00
|
|
|
++i;
|
|
|
|
clonev[i] = NULL;
|
|
|
|
|
2015-09-23 19:13:59 -04:00
|
|
|
prop2.name = (char *)SmCloneCommand;
|
|
|
|
prop2.type = (char *)SmLISTofARRAY8;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
prop2.vals = g_new (SmPropValue, i);
|
|
|
|
i = 0;
|
|
|
|
while (clonev[i])
|
|
|
|
{
|
|
|
|
prop2.vals[i].value = clonev[i];
|
|
|
|
prop2.vals[i].length = strlen (clonev[i]);
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
prop2.num_vals = i;
|
|
|
|
|
2001-07-26 01:10:01 -04:00
|
|
|
/* Discard */
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-26 01:10:01 -04:00
|
|
|
i = 0;
|
2015-09-23 19:13:59 -04:00
|
|
|
discardv[i] = (char *)"rm";
|
2001-07-26 01:10:01 -04:00
|
|
|
++i;
|
2015-09-23 19:13:59 -04:00
|
|
|
discardv[i] = (char *)"-f";
|
2001-07-26 01:10:01 -04:00
|
|
|
++i;
|
2002-03-13 23:09:42 -05:00
|
|
|
discardv[i] = (char*) full_save_file ();
|
2002-03-17 10:26:13 -05:00
|
|
|
++i;
|
|
|
|
discardv[i] = NULL;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2015-09-23 19:13:59 -04:00
|
|
|
prop3.name = (char *)SmDiscardCommand;
|
|
|
|
prop3.type = (char *)SmLISTofARRAY8;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-26 01:10:01 -04:00
|
|
|
prop3.vals = g_new (SmPropValue, i);
|
|
|
|
i = 0;
|
2002-03-17 10:26:13 -05:00
|
|
|
while (discardv[i])
|
2001-07-26 01:10:01 -04:00
|
|
|
{
|
|
|
|
prop3.vals[i].value = discardv[i];
|
|
|
|
prop3.vals[i].length = strlen (discardv[i]);
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
prop3.num_vals = i;
|
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
props[0] = &prop1;
|
|
|
|
props[1] = &prop2;
|
2001-07-26 01:10:01 -04:00
|
|
|
props[2] = &prop3;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-26 01:10:01 -04:00
|
|
|
SmcSetProperties (session_connection, 3, props);
|
|
|
|
|
2001-07-28 02:35:19 -04:00
|
|
|
g_free (prop1.vals);
|
|
|
|
g_free (prop2.vals);
|
|
|
|
g_free (prop3.vals);
|
2001-07-26 01:10:01 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* The remaining code in this file actually loads/saves the session,
|
|
|
|
* while the code above this comment handles chatting with the
|
|
|
|
* session manager.
|
|
|
|
*/
|
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
static const char*
|
|
|
|
window_type_to_string (MetaWindowType type)
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case META_WINDOW_NORMAL:
|
|
|
|
return "normal";
|
|
|
|
case META_WINDOW_DESKTOP:
|
|
|
|
return "desktop";
|
|
|
|
case META_WINDOW_DOCK:
|
|
|
|
return "dock";
|
|
|
|
case META_WINDOW_DIALOG:
|
|
|
|
return "dialog";
|
|
|
|
case META_WINDOW_MODAL_DIALOG:
|
|
|
|
return "modal_dialog";
|
|
|
|
case META_WINDOW_TOOLBAR:
|
|
|
|
return "toolbar";
|
|
|
|
case META_WINDOW_MENU:
|
|
|
|
return "menu";
|
2002-02-09 01:54:44 -05:00
|
|
|
case META_WINDOW_SPLASHSCREEN:
|
|
|
|
return "splashscreen";
|
|
|
|
case META_WINDOW_UTILITY:
|
|
|
|
return "utility";
|
2008-11-23 14:28:40 -05:00
|
|
|
case META_WINDOW_DROPDOWN_MENU:
|
|
|
|
return "dropdown_menu";
|
|
|
|
case META_WINDOW_POPUP_MENU:
|
|
|
|
return "popup_menu";
|
|
|
|
case META_WINDOW_TOOLTIP:
|
|
|
|
return "tooltip";
|
|
|
|
case META_WINDOW_NOTIFICATION:
|
|
|
|
return "notification";
|
|
|
|
case META_WINDOW_COMBO:
|
|
|
|
return "combo";
|
|
|
|
case META_WINDOW_DND:
|
|
|
|
return "dnd";
|
|
|
|
case META_WINDOW_OVERRIDE_OTHER:
|
|
|
|
return "override_redirect";
|
2001-07-27 00:22:18 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
2014-05-02 09:34:02 -04:00
|
|
|
}
|
2001-07-27 00:22:18 -04:00
|
|
|
|
|
|
|
static MetaWindowType
|
|
|
|
window_type_from_string (const char *str)
|
|
|
|
{
|
|
|
|
if (strcmp (str, "normal") == 0)
|
|
|
|
return META_WINDOW_NORMAL;
|
|
|
|
else if (strcmp (str, "desktop") == 0)
|
|
|
|
return META_WINDOW_DESKTOP;
|
|
|
|
else if (strcmp (str, "dock") == 0)
|
|
|
|
return META_WINDOW_DOCK;
|
|
|
|
else if (strcmp (str, "dialog") == 0)
|
|
|
|
return META_WINDOW_DIALOG;
|
|
|
|
else if (strcmp (str, "modal_dialog") == 0)
|
|
|
|
return META_WINDOW_MODAL_DIALOG;
|
|
|
|
else if (strcmp (str, "toolbar") == 0)
|
|
|
|
return META_WINDOW_TOOLBAR;
|
|
|
|
else if (strcmp (str, "menu") == 0)
|
|
|
|
return META_WINDOW_MENU;
|
2002-02-09 01:54:44 -05:00
|
|
|
else if (strcmp (str, "utility") == 0)
|
|
|
|
return META_WINDOW_UTILITY;
|
|
|
|
else if (strcmp (str, "splashscreen") == 0)
|
|
|
|
return META_WINDOW_SPLASHSCREEN;
|
2001-07-27 00:22:18 -04:00
|
|
|
else
|
|
|
|
return META_WINDOW_NORMAL;
|
|
|
|
}
|
|
|
|
|
2001-07-28 02:11:15 -04:00
|
|
|
static int
|
|
|
|
window_gravity_from_string (const char *str)
|
|
|
|
{
|
2020-02-14 03:44:43 -05:00
|
|
|
if (strcmp (str, "META_GRAVITY_NORTH_WEST") == 0)
|
|
|
|
return META_GRAVITY_NORTH_WEST;
|
|
|
|
else if (strcmp (str, "META_GRAVITY_NORTH") == 0)
|
|
|
|
return META_GRAVITY_NORTH;
|
|
|
|
else if (strcmp (str, "META_GRAVITY_NORTH_EAST") == 0)
|
|
|
|
return META_GRAVITY_NORTH_EAST;
|
|
|
|
else if (strcmp (str, "META_GRAVITY_WEST") == 0)
|
|
|
|
return META_GRAVITY_WEST;
|
|
|
|
else if (strcmp (str, "META_GRAVITY_CENTER") == 0)
|
|
|
|
return META_GRAVITY_CENTER;
|
|
|
|
else if (strcmp (str, "META_GRAVITY_EAST") == 0)
|
|
|
|
return META_GRAVITY_EAST;
|
|
|
|
else if (strcmp (str, "META_GRAVITY_SOUTH_WEST") == 0)
|
|
|
|
return META_GRAVITY_SOUTH_WEST;
|
|
|
|
else if (strcmp (str, "META_GRAVITY_SOUTH") == 0)
|
|
|
|
return META_GRAVITY_SOUTH;
|
|
|
|
else if (strcmp (str, "META_GRAVITY_SOUTH_EAST") == 0)
|
|
|
|
return META_GRAVITY_SOUTH_EAST;
|
|
|
|
else if (strcmp (str, "META_GRAVITY_STATIC") == 0)
|
|
|
|
return META_GRAVITY_STATIC;
|
2001-07-28 02:11:15 -04:00
|
|
|
else
|
2020-02-14 03:44:43 -05:00
|
|
|
return META_GRAVITY_NORTH_WEST;
|
2001-07-28 02:11:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static char*
|
2001-10-04 22:58:48 -04:00
|
|
|
encode_text_as_utf8_markup (const char *text)
|
2001-07-28 02:11:15 -04:00
|
|
|
{
|
|
|
|
/* text can be any encoding, and is nul-terminated.
|
|
|
|
* we pretend it's Latin-1 and encode as UTF-8
|
|
|
|
*/
|
|
|
|
GString *str;
|
|
|
|
const char *p;
|
2001-10-04 22:58:48 -04:00
|
|
|
char *escaped;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-28 02:11:15 -04:00
|
|
|
str = g_string_new ("");
|
|
|
|
|
|
|
|
p = text;
|
|
|
|
while (*p)
|
|
|
|
{
|
|
|
|
g_string_append_unichar (str, *p);
|
|
|
|
++p;
|
|
|
|
}
|
|
|
|
|
2001-10-04 22:58:48 -04:00
|
|
|
escaped = g_markup_escape_text (str->str, str->len);
|
|
|
|
g_string_free (str, TRUE);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-10-04 22:58:48 -04:00
|
|
|
return escaped;
|
2001-07-28 02:11:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static char*
|
|
|
|
decode_text_from_utf8 (const char *text)
|
|
|
|
{
|
2001-10-04 22:58:48 -04:00
|
|
|
/* Convert back from the encoded (but not escaped) UTF-8 */
|
2001-07-28 02:11:15 -04:00
|
|
|
GString *str;
|
|
|
|
const char *p;
|
|
|
|
|
|
|
|
str = g_string_new ("");
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-28 02:11:15 -04:00
|
|
|
p = text;
|
|
|
|
while (*p)
|
|
|
|
{
|
|
|
|
/* obviously this barfs if the UTF-8 contains chars > 255 */
|
|
|
|
g_string_append_c (str, g_utf8_get_char (p));
|
|
|
|
|
|
|
|
p = g_utf8_next_char (p);
|
|
|
|
}
|
|
|
|
|
|
|
|
return g_string_free (str, FALSE);
|
|
|
|
}
|
|
|
|
|
2001-07-26 01:10:01 -04:00
|
|
|
static void
|
|
|
|
save_state (void)
|
|
|
|
{
|
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
|
|
|
char *mutter_dir;
|
2001-07-26 01:10:01 -04:00
|
|
|
char *session_dir;
|
|
|
|
FILE *outfile;
|
2008-04-07 16:50:37 -04:00
|
|
|
GSList *windows;
|
|
|
|
GSList *tmp;
|
|
|
|
int stack_position;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-26 01:10:01 -04:00
|
|
|
g_assert (client_id);
|
|
|
|
|
|
|
|
outfile = NULL;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2008-03-27 09:12:28 -04:00
|
|
|
/*
|
|
|
|
* g_get_user_config_dir() is guaranteed to return an existing directory.
|
|
|
|
* Eventually, if SM stays with the WM, I'd like to make this
|
|
|
|
* something like <config>/window_placement in a standard format.
|
|
|
|
* Future optimisers should note also that by the time we get here
|
|
|
|
* we probably already have full_save_path figured out and therefore
|
|
|
|
* can just use the directory name from that.
|
|
|
|
*/
|
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_dir = g_strconcat (g_get_user_config_dir (),
|
|
|
|
G_DIR_SEPARATOR_S "mutter",
|
2001-07-26 01:10:01 -04:00
|
|
|
NULL);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
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
|
|
|
session_dir = g_strconcat (mutter_dir,
|
2008-03-27 09:12:28 -04:00
|
|
|
G_DIR_SEPARATOR_S "sessions",
|
2001-07-26 01:10:01 -04:00
|
|
|
NULL);
|
|
|
|
|
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
|
|
|
if (mkdir (mutter_dir, 0700) < 0 &&
|
2001-07-26 01:10:01 -04:00
|
|
|
errno != EEXIST)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_warning ("Could not create directory '%s': %s",
|
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_dir, g_strerror (errno));
|
2001-07-26 01:10:01 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (mkdir (session_dir, 0700) < 0 &&
|
|
|
|
errno != EEXIST)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_warning ("Could not create directory '%s': %s",
|
2001-07-26 01:10:01 -04:00
|
|
|
session_dir, g_strerror (errno));
|
|
|
|
}
|
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Saving session to '%s'", full_save_file ());
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-03-13 23:09:42 -05:00
|
|
|
outfile = fopen (full_save_file (), "w");
|
2001-07-26 01:10:01 -04:00
|
|
|
|
|
|
|
if (outfile == NULL)
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_warning ("Could not open session file '%s' for writing: %s",
|
2002-03-13 23:09:42 -05:00
|
|
|
full_save_file (), g_strerror (errno));
|
2001-07-26 01:10:01 -04:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The file format is:
|
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_session id="foo">
|
2002-06-22 20:21:20 -04:00
|
|
|
* <window id="bar" class="XTerm" name="xterm" title="/foo/bar" role="blah" type="normal" stacking="5">
|
2001-07-27 00:22:18 -04:00
|
|
|
* <workspace index="2"/>
|
|
|
|
* <workspace index="4"/>
|
2002-06-22 20:21:20 -04:00
|
|
|
* <sticky/> <minimized/> <maximized/>
|
2001-07-26 01:10:01 -04:00
|
|
|
* <geometry x="100" y="100" width="200" height="200" gravity="northwest"/>
|
|
|
|
* </window>
|
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_session>
|
2001-07-27 00:22:18 -04:00
|
|
|
*
|
|
|
|
* Note that attributes on <window> are the match info we use to
|
|
|
|
* see if the saved state applies to a restored window, and
|
|
|
|
* child elements are the saved state to be applied.
|
2014-05-02 09:34:02 -04:00
|
|
|
*
|
2001-07-26 01:10:01 -04:00
|
|
|
*/
|
2014-05-02 09:34:02 -04:00
|
|
|
|
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
|
|
|
fprintf (outfile, "<mutter_session id=\"%s\">\n",
|
2001-07-26 01:10:01 -04:00
|
|
|
client_id);
|
2008-04-07 16:50:37 -04:00
|
|
|
|
2009-06-15 15:32:23 -04:00
|
|
|
windows = meta_display_list_windows (meta_get_display (), META_LIST_DEFAULT);
|
2008-04-07 16:50:37 -04:00
|
|
|
stack_position = 0;
|
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
windows = g_slist_sort (windows, meta_display_stack_cmp);
|
|
|
|
tmp = windows;
|
|
|
|
stack_position = 0;
|
2002-06-22 20:21:20 -04:00
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *window;
|
2001-07-26 01:10:01 -04:00
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
window = tmp->data;
|
2001-07-26 01:10:01 -04:00
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
if (window->sm_client_id)
|
|
|
|
{
|
|
|
|
char *sm_client_id;
|
|
|
|
char *res_class;
|
|
|
|
char *res_name;
|
|
|
|
char *role;
|
|
|
|
char *title;
|
|
|
|
|
|
|
|
/* client id, class, name, role are not expected to be
|
|
|
|
* in UTF-8 (I think they are in XPCS which is Latin-1?
|
|
|
|
* in practice they are always ascii though.)
|
|
|
|
*/
|
2014-05-02 09:34:02 -04:00
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
sm_client_id = encode_text_as_utf8_markup (window->sm_client_id);
|
|
|
|
res_class = window->res_class ?
|
|
|
|
encode_text_as_utf8_markup (window->res_class) : NULL;
|
|
|
|
res_name = window->res_name ?
|
|
|
|
encode_text_as_utf8_markup (window->res_name) : NULL;
|
|
|
|
role = window->role ?
|
|
|
|
encode_text_as_utf8_markup (window->role) : NULL;
|
|
|
|
if (window->title)
|
|
|
|
title = g_markup_escape_text (window->title, -1);
|
|
|
|
else
|
|
|
|
title = NULL;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Saving session managed window %s, client ID '%s'",
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
window->desc, window->sm_client_id);
|
|
|
|
|
|
|
|
fprintf (outfile,
|
|
|
|
" <window id=\"%s\" class=\"%s\" name=\"%s\" title=\"%s\" role=\"%s\" type=\"%s\" stacking=\"%d\">\n",
|
|
|
|
sm_client_id,
|
|
|
|
res_class ? res_class : "",
|
|
|
|
res_name ? res_name : "",
|
|
|
|
title ? title : "",
|
|
|
|
role ? role : "",
|
|
|
|
window_type_to_string (window->type),
|
|
|
|
stack_position);
|
|
|
|
|
|
|
|
g_free (sm_client_id);
|
|
|
|
g_free (res_class);
|
|
|
|
g_free (res_name);
|
|
|
|
g_free (role);
|
|
|
|
g_free (title);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
/* Sticky */
|
2011-02-28 05:41:23 -05:00
|
|
|
if (window->on_all_workspaces_requested)
|
2015-10-15 09:35:33 -04:00
|
|
|
{
|
|
|
|
fputs (" <sticky/>\n", outfile);
|
|
|
|
} else {
|
|
|
|
int n;
|
2018-01-23 05:43:09 -05:00
|
|
|
if (window->workspace)
|
|
|
|
n = meta_workspace_index (window->workspace);
|
|
|
|
else
|
|
|
|
n = window->initial_workspace;
|
2015-10-15 09:35:33 -04:00
|
|
|
fprintf (outfile,
|
|
|
|
" <workspace index=\"%d\"/>\n", n);
|
|
|
|
}
|
|
|
|
|
2001-07-26 01:10:01 -04:00
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
/* Minimized */
|
|
|
|
if (window->minimized)
|
|
|
|
fputs (" <minimized/>\n", outfile);
|
|
|
|
|
|
|
|
/* Maximized */
|
|
|
|
if (META_WINDOW_MAXIMIZED (window))
|
|
|
|
{
|
2001-07-26 01:10:01 -04:00
|
|
|
fprintf (outfile,
|
2014-05-02 09:34:02 -04:00
|
|
|
" <maximized saved_x=\"%d\" saved_y=\"%d\" saved_width=\"%d\" saved_height=\"%d\"/>\n",
|
2016-01-10 09:16:09 -05:00
|
|
|
window->saved_rect.x,
|
|
|
|
window->saved_rect.y,
|
|
|
|
window->saved_rect.width,
|
|
|
|
window->saved_rect.height);
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
/* Gravity */
|
|
|
|
{
|
|
|
|
int x, y, w, h;
|
2014-05-21 13:49:24 -04:00
|
|
|
meta_window_get_session_geometry (window, &x, &y, &w, &h);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
fprintf (outfile,
|
|
|
|
" <geometry x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" gravity=\"%s\"/>\n",
|
|
|
|
x, y, w, h,
|
|
|
|
meta_gravity_to_string (window->size_hints.win_gravity));
|
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
fputs (" </window>\n", outfile);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Not saving window '%s', not session managed",
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
window->desc);
|
2001-07-26 01:10:01 -04:00
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
tmp = tmp->next;
|
|
|
|
++stack_position;
|
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
g_slist_free (windows);
|
2001-07-26 01:10:01 -04:00
|
|
|
|
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
|
|
|
fputs ("</mutter_session>\n", outfile);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-26 01:10:01 -04:00
|
|
|
out:
|
|
|
|
if (outfile)
|
|
|
|
{
|
2001-09-15 20:30:45 -04:00
|
|
|
/* FIXME need a dialog for this */
|
|
|
|
if (ferror (outfile))
|
2001-07-26 01:10:01 -04:00
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_warning ("Error writing session file '%s': %s",
|
2002-03-13 23:09:42 -05:00
|
|
|
full_save_file (), g_strerror (errno));
|
2001-07-26 01:10:01 -04:00
|
|
|
}
|
2001-09-15 20:30:45 -04:00
|
|
|
if (fclose (outfile))
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_warning ("Error closing session file '%s': %s",
|
2002-03-13 23:09:42 -05:00
|
|
|
full_save_file (), g_strerror (errno));
|
2001-09-15 20:30:45 -04:00
|
|
|
}
|
2001-07-26 01:10:01 -04:00
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
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
|
|
|
g_free (mutter_dir);
|
2001-07-26 01:10:01 -04:00
|
|
|
g_free (session_dir);
|
|
|
|
}
|
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
WINDOW_TAG_NONE,
|
|
|
|
WINDOW_TAG_DESKTOP,
|
|
|
|
WINDOW_TAG_STICKY,
|
2002-06-22 20:21:20 -04:00
|
|
|
WINDOW_TAG_MINIMIZED,
|
|
|
|
WINDOW_TAG_MAXIMIZED,
|
2001-07-27 00:22:18 -04:00
|
|
|
WINDOW_TAG_GEOMETRY
|
|
|
|
} WindowTag;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
MetaWindowSessionInfo *info;
|
2002-03-13 23:36:02 -05:00
|
|
|
char *previous_id;
|
2001-07-27 00:22:18 -04:00
|
|
|
} ParseData;
|
|
|
|
|
|
|
|
static void session_info_free (MetaWindowSessionInfo *info);
|
|
|
|
static MetaWindowSessionInfo* session_info_new (void);
|
|
|
|
|
|
|
|
static void start_element_handler (GMarkupParseContext *context,
|
|
|
|
const gchar *element_name,
|
|
|
|
const gchar **attribute_names,
|
|
|
|
const gchar **attribute_values,
|
|
|
|
gpointer user_data,
|
|
|
|
GError **error);
|
|
|
|
static void end_element_handler (GMarkupParseContext *context,
|
|
|
|
const gchar *element_name,
|
|
|
|
gpointer user_data,
|
|
|
|
GError **error);
|
|
|
|
static void text_handler (GMarkupParseContext *context,
|
|
|
|
const gchar *text,
|
|
|
|
gsize text_len,
|
|
|
|
gpointer user_data,
|
|
|
|
GError **error);
|
|
|
|
|
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
|
|
|
static GMarkupParser mutter_session_parser = {
|
2001-07-27 00:22:18 -04:00
|
|
|
start_element_handler,
|
|
|
|
end_element_handler,
|
|
|
|
text_handler,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
static GSList *window_info_list = NULL;
|
|
|
|
|
2002-03-13 23:36:02 -05:00
|
|
|
static char*
|
2002-03-13 23:09:42 -05:00
|
|
|
load_state (const char *previous_save_file)
|
2001-07-26 01:10:01 -04:00
|
|
|
{
|
2001-07-27 00:22:18 -04:00
|
|
|
GMarkupParseContext *context;
|
|
|
|
GError *error;
|
|
|
|
ParseData parse_data;
|
|
|
|
char *text;
|
2002-04-25 12:25:07 -04:00
|
|
|
gsize length;
|
2001-07-27 00:22:18 -04:00
|
|
|
char *session_file;
|
|
|
|
|
2008-03-27 09:12:28 -04:00
|
|
|
session_file = g_strconcat (g_get_user_config_dir (),
|
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
|
|
|
G_DIR_SEPARATOR_S "mutter"
|
2008-03-27 09:12:28 -04:00
|
|
|
G_DIR_SEPARATOR_S "sessions" G_DIR_SEPARATOR_S,
|
2002-03-13 23:09:42 -05:00
|
|
|
previous_save_file,
|
2001-07-27 00:22:18 -04:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
error = NULL;
|
|
|
|
if (!g_file_get_contents (session_file,
|
|
|
|
&text,
|
|
|
|
&length,
|
|
|
|
&error))
|
|
|
|
{
|
2008-03-27 09:12:28 -04:00
|
|
|
char *canonical_session_file = session_file;
|
|
|
|
|
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
|
|
|
/* Maybe they were doing it the old way, with ~/.mutter */
|
2008-03-27 09:12:28 -04:00
|
|
|
session_file = g_strconcat (g_get_home_dir (),
|
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
|
|
|
G_DIR_SEPARATOR_S ".mutter"
|
2008-03-27 09:12:28 -04:00
|
|
|
G_DIR_SEPARATOR_S "sessions"
|
|
|
|
G_DIR_SEPARATOR_S,
|
|
|
|
previous_save_file,
|
|
|
|
NULL);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2008-03-27 09:12:28 -04:00
|
|
|
if (!g_file_get_contents (session_file,
|
|
|
|
&text,
|
|
|
|
&length,
|
|
|
|
NULL))
|
|
|
|
{
|
|
|
|
/* oh, just give up */
|
|
|
|
|
|
|
|
g_error_free (error);
|
|
|
|
g_free (session_file);
|
|
|
|
g_free (canonical_session_file);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (canonical_session_file);
|
2001-07-27 00:22:18 -04:00
|
|
|
}
|
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Parsing saved session file %s", session_file);
|
2001-07-28 02:11:15 -04:00
|
|
|
g_free (session_file);
|
|
|
|
session_file = NULL;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
parse_data.info = NULL;
|
2002-03-13 23:36:02 -05:00
|
|
|
parse_data.previous_id = NULL;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
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
|
|
|
context = g_markup_parse_context_new (&mutter_session_parser,
|
2001-07-27 00:22:18 -04:00
|
|
|
0, &parse_data, NULL);
|
|
|
|
|
|
|
|
error = NULL;
|
|
|
|
if (!g_markup_parse_context_parse (context,
|
|
|
|
text,
|
|
|
|
length,
|
|
|
|
&error))
|
|
|
|
goto error;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
error = NULL;
|
|
|
|
if (!g_markup_parse_context_end_parse (context, &error))
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
g_markup_parse_context_free (context);
|
|
|
|
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
error:
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_warning ("Failed to parse saved session file: %s",
|
2001-07-27 00:22:18 -04:00
|
|
|
error->message);
|
|
|
|
g_error_free (error);
|
|
|
|
|
2001-07-28 02:11:15 -04:00
|
|
|
if (parse_data.info)
|
|
|
|
session_info_free (parse_data.info);
|
2002-03-13 23:36:02 -05:00
|
|
|
|
|
|
|
g_free (parse_data.previous_id);
|
|
|
|
parse_data.previous_id = NULL;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
out:
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
g_free (text);
|
2002-03-13 23:36:02 -05:00
|
|
|
|
|
|
|
return parse_data.previous_id;
|
2001-07-27 00:22:18 -04:00
|
|
|
}
|
|
|
|
|
2001-07-27 00:36:44 -04:00
|
|
|
/* FIXME this isn't very robust against bogus session files */
|
2001-07-27 00:22:18 -04:00
|
|
|
static void
|
|
|
|
start_element_handler (GMarkupParseContext *context,
|
|
|
|
const gchar *element_name,
|
|
|
|
const gchar **attribute_names,
|
|
|
|
const gchar **attribute_values,
|
|
|
|
gpointer user_data,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
ParseData *pd;
|
|
|
|
|
|
|
|
pd = user_data;
|
|
|
|
|
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
|
|
|
if (strcmp (element_name, "mutter_session") == 0)
|
2001-07-27 00:36:44 -04:00
|
|
|
{
|
2002-03-13 23:09:42 -05:00
|
|
|
/* Get previous ID */
|
2014-05-02 09:34:02 -04:00
|
|
|
int i;
|
2002-03-13 23:09:42 -05:00
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (attribute_names[i])
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
const char *val;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-03-13 23:09:42 -05:00
|
|
|
name = attribute_names[i];
|
|
|
|
val = attribute_values[i];
|
|
|
|
|
2002-03-13 23:36:02 -05:00
|
|
|
if (pd->previous_id)
|
2002-03-13 23:09:42 -05:00
|
|
|
{
|
|
|
|
g_set_error (error,
|
|
|
|
G_MARKUP_ERROR,
|
|
|
|
G_MARKUP_ERROR_PARSE,
|
2013-09-11 04:37:36 -04:00
|
|
|
"<mutter_session> attribute seen but we already have the session ID");
|
2002-03-13 23:09:42 -05:00
|
|
|
return;
|
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-03-13 23:09:42 -05:00
|
|
|
if (strcmp (name, "id") == 0)
|
|
|
|
{
|
2002-03-13 23:36:02 -05:00
|
|
|
pd->previous_id = decode_text_from_utf8 (val);
|
2002-03-13 23:09:42 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_set_error (error,
|
|
|
|
G_MARKUP_ERROR,
|
|
|
|
G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
|
2013-09-11 04:37:36 -04:00
|
|
|
"Unknown attribute %s on <%s> element",
|
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
|
|
|
name, "mutter_session");
|
2002-03-13 23:09:42 -05:00
|
|
|
return;
|
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-03-13 23:09:42 -05:00
|
|
|
++i;
|
|
|
|
}
|
2001-07-27 00:36:44 -04:00
|
|
|
}
|
|
|
|
else if (strcmp (element_name, "window") == 0)
|
2001-07-27 00:22:18 -04:00
|
|
|
{
|
|
|
|
int i;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
if (pd->info)
|
|
|
|
{
|
|
|
|
g_set_error (error,
|
|
|
|
G_MARKUP_ERROR,
|
|
|
|
G_MARKUP_ERROR_PARSE,
|
2013-09-11 04:37:36 -04:00
|
|
|
"nested <window> tag");
|
2001-07-27 00:22:18 -04:00
|
|
|
return;
|
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
pd->info = session_info_new ();
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (attribute_names[i])
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
const char *val;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
name = attribute_names[i];
|
|
|
|
val = attribute_values[i];
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
if (strcmp (name, "id") == 0)
|
|
|
|
{
|
|
|
|
if (*val)
|
2001-07-28 02:11:15 -04:00
|
|
|
pd->info->id = decode_text_from_utf8 (val);
|
2001-07-27 00:22:18 -04:00
|
|
|
}
|
|
|
|
else if (strcmp (name, "class") == 0)
|
|
|
|
{
|
|
|
|
if (*val)
|
2001-07-28 02:11:15 -04:00
|
|
|
pd->info->res_class = decode_text_from_utf8 (val);
|
2001-07-27 00:22:18 -04:00
|
|
|
}
|
|
|
|
else if (strcmp (name, "name") == 0)
|
|
|
|
{
|
|
|
|
if (*val)
|
2001-07-28 02:11:15 -04:00
|
|
|
pd->info->res_name = decode_text_from_utf8 (val);
|
2001-07-27 00:22:18 -04:00
|
|
|
}
|
|
|
|
else if (strcmp (name, "title") == 0)
|
|
|
|
{
|
|
|
|
if (*val)
|
|
|
|
pd->info->title = g_strdup (val);
|
|
|
|
}
|
|
|
|
else if (strcmp (name, "role") == 0)
|
|
|
|
{
|
|
|
|
if (*val)
|
2001-07-28 02:11:15 -04:00
|
|
|
pd->info->role = decode_text_from_utf8 (val);
|
2001-07-27 00:22:18 -04:00
|
|
|
}
|
|
|
|
else if (strcmp (name, "type") == 0)
|
|
|
|
{
|
|
|
|
if (*val)
|
|
|
|
pd->info->type = window_type_from_string (val);
|
|
|
|
}
|
2002-06-22 20:21:20 -04:00
|
|
|
else if (strcmp (name, "stacking") == 0)
|
|
|
|
{
|
|
|
|
if (*val)
|
|
|
|
{
|
|
|
|
pd->info->stack_position = atoi (val);
|
|
|
|
pd->info->stack_position_set = TRUE;
|
|
|
|
}
|
|
|
|
}
|
2001-07-27 00:22:18 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
g_set_error (error,
|
|
|
|
G_MARKUP_ERROR,
|
|
|
|
G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
|
2013-09-11 04:37:36 -04:00
|
|
|
"Unknown attribute %s on <%s> element",
|
An attempt to make life a little easier for our beloved translators; this
2008-10-12 Thomas Thurman <tthurman@gnome.org>
An attempt to make life a little easier for our beloved translators;
this has the same behaviour as before, but removes over thirty
translation strings.
* src/core/session.c (start_element_handler): all "attribute not found
on element" strings are identical
* src/ui/theme-parser.c (locate_attributes): allow attribute names to
be preceded with "!" (in the code) to show they're required.
(parse_aspect_ratio, parse_distance, parse_toplevel_element,
parse_style_element, parse_gradient_element, static, parse_border,
parse_style_set_element, parse_draw_op_element): use the new "!"
prefix for locate_attributes(), or in some cases just the identical
constant, for generating this error.
* src/ui/theme.c (check_state, meta_theme_validate): add
translator comments
* src/ui/resizepopup.c (update_size_window): add
translator comments
svn path=/trunk/; revision=3949
2008-10-12 10:34:54 -04:00
|
|
|
name, "window");
|
2001-07-27 00:22:18 -04:00
|
|
|
session_info_free (pd->info);
|
|
|
|
pd->info = NULL;
|
|
|
|
return;
|
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (strcmp (element_name, "workspace") == 0)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (attribute_names[i])
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
name = attribute_names[i];
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
if (strcmp (name, "index") == 0)
|
|
|
|
{
|
|
|
|
pd->info->workspace_indices =
|
|
|
|
g_slist_prepend (pd->info->workspace_indices,
|
|
|
|
GINT_TO_POINTER (atoi (attribute_values[i])));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_set_error (error,
|
|
|
|
G_MARKUP_ERROR,
|
|
|
|
G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
|
2013-09-11 04:37:36 -04:00
|
|
|
"Unknown attribute %s on <%s> element",
|
An attempt to make life a little easier for our beloved translators; this
2008-10-12 Thomas Thurman <tthurman@gnome.org>
An attempt to make life a little easier for our beloved translators;
this has the same behaviour as before, but removes over thirty
translation strings.
* src/core/session.c (start_element_handler): all "attribute not found
on element" strings are identical
* src/ui/theme-parser.c (locate_attributes): allow attribute names to
be preceded with "!" (in the code) to show they're required.
(parse_aspect_ratio, parse_distance, parse_toplevel_element,
parse_style_element, parse_gradient_element, static, parse_border,
parse_style_set_element, parse_draw_op_element): use the new "!"
prefix for locate_attributes(), or in some cases just the identical
constant, for generating this error.
* src/ui/theme.c (check_state, meta_theme_validate): add
translator comments
* src/ui/resizepopup.c (update_size_window): add
translator comments
svn path=/trunk/; revision=3949
2008-10-12 10:34:54 -04:00
|
|
|
name, "window");
|
2001-07-27 00:22:18 -04:00
|
|
|
session_info_free (pd->info);
|
|
|
|
pd->info = NULL;
|
|
|
|
return;
|
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (strcmp (element_name, "sticky") == 0)
|
|
|
|
{
|
|
|
|
pd->info->on_all_workspaces = TRUE;
|
|
|
|
pd->info->on_all_workspaces_set = TRUE;
|
|
|
|
}
|
2002-06-22 20:21:20 -04:00
|
|
|
else if (strcmp (element_name, "minimized") == 0)
|
|
|
|
{
|
|
|
|
pd->info->minimized = TRUE;
|
|
|
|
pd->info->minimized_set = TRUE;
|
|
|
|
}
|
|
|
|
else if (strcmp (element_name, "maximized") == 0)
|
|
|
|
{
|
2002-09-03 22:44:52 -04:00
|
|
|
int i;
|
|
|
|
|
|
|
|
i = 0;
|
2002-06-22 20:21:20 -04:00
|
|
|
pd->info->maximized = TRUE;
|
|
|
|
pd->info->maximized_set = TRUE;
|
2002-09-03 22:44:52 -04:00
|
|
|
while (attribute_names[i])
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
const char *val;
|
|
|
|
|
|
|
|
name = attribute_names[i];
|
|
|
|
val = attribute_values[i];
|
|
|
|
|
|
|
|
if (strcmp (name, "saved_x") == 0)
|
|
|
|
{
|
|
|
|
if (*val)
|
|
|
|
{
|
|
|
|
pd->info->saved_rect.x = atoi (val);
|
|
|
|
pd->info->saved_rect_set = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (strcmp (name, "saved_y") == 0)
|
|
|
|
{
|
|
|
|
if (*val)
|
|
|
|
{
|
|
|
|
pd->info->saved_rect.y = atoi (val);
|
|
|
|
pd->info->saved_rect_set = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (strcmp (name, "saved_width") == 0)
|
|
|
|
{
|
|
|
|
if (*val)
|
|
|
|
{
|
|
|
|
pd->info->saved_rect.width = atoi (val);
|
|
|
|
pd->info->saved_rect_set = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (strcmp (name, "saved_height") == 0)
|
|
|
|
{
|
|
|
|
if (*val)
|
|
|
|
{
|
|
|
|
pd->info->saved_rect.height = atoi (val);
|
|
|
|
pd->info->saved_rect_set = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_set_error (error,
|
|
|
|
G_MARKUP_ERROR,
|
|
|
|
G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
|
2013-09-11 04:37:36 -04:00
|
|
|
"Unknown attribute %s on <%s> element",
|
An attempt to make life a little easier for our beloved translators; this
2008-10-12 Thomas Thurman <tthurman@gnome.org>
An attempt to make life a little easier for our beloved translators;
this has the same behaviour as before, but removes over thirty
translation strings.
* src/core/session.c (start_element_handler): all "attribute not found
on element" strings are identical
* src/ui/theme-parser.c (locate_attributes): allow attribute names to
be preceded with "!" (in the code) to show they're required.
(parse_aspect_ratio, parse_distance, parse_toplevel_element,
parse_style_element, parse_gradient_element, static, parse_border,
parse_style_set_element, parse_draw_op_element): use the new "!"
prefix for locate_attributes(), or in some cases just the identical
constant, for generating this error.
* src/ui/theme.c (check_state, meta_theme_validate): add
translator comments
* src/ui/resizepopup.c (update_size_window): add
translator comments
svn path=/trunk/; revision=3949
2008-10-12 10:34:54 -04:00
|
|
|
name, "maximized");
|
2002-09-03 22:44:52 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pd->info->saved_rect_set)
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Saved unmaximized size %d,%d %dx%d ",
|
2002-09-03 22:44:52 -04:00
|
|
|
pd->info->saved_rect.x,
|
|
|
|
pd->info->saved_rect.y,
|
|
|
|
pd->info->saved_rect.width,
|
|
|
|
pd->info->saved_rect.height);
|
2014-05-02 09:34:02 -04:00
|
|
|
}
|
2001-07-27 00:22:18 -04:00
|
|
|
else if (strcmp (element_name, "geometry") == 0)
|
|
|
|
{
|
2001-07-28 02:11:15 -04:00
|
|
|
int i;
|
2001-07-27 00:22:18 -04:00
|
|
|
|
2001-07-28 02:11:15 -04:00
|
|
|
pd->info->geometry_set = TRUE;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-28 02:11:15 -04:00
|
|
|
i = 0;
|
|
|
|
while (attribute_names[i])
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
const char *val;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-28 02:11:15 -04:00
|
|
|
name = attribute_names[i];
|
|
|
|
val = attribute_values[i];
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-28 02:11:15 -04:00
|
|
|
if (strcmp (name, "x") == 0)
|
|
|
|
{
|
|
|
|
if (*val)
|
|
|
|
pd->info->rect.x = atoi (val);
|
|
|
|
}
|
|
|
|
else if (strcmp (name, "y") == 0)
|
|
|
|
{
|
|
|
|
if (*val)
|
|
|
|
pd->info->rect.y = atoi (val);
|
|
|
|
}
|
|
|
|
else if (strcmp (name, "width") == 0)
|
|
|
|
{
|
|
|
|
if (*val)
|
|
|
|
pd->info->rect.width = atoi (val);
|
|
|
|
}
|
|
|
|
else if (strcmp (name, "height") == 0)
|
|
|
|
{
|
|
|
|
if (*val)
|
|
|
|
pd->info->rect.height = atoi (val);
|
|
|
|
}
|
|
|
|
else if (strcmp (name, "gravity") == 0)
|
|
|
|
{
|
|
|
|
if (*val)
|
|
|
|
pd->info->gravity = window_gravity_from_string (val);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_set_error (error,
|
|
|
|
G_MARKUP_ERROR,
|
|
|
|
G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
|
2013-09-11 04:37:36 -04:00
|
|
|
"Unknown attribute %s on <%s> element",
|
An attempt to make life a little easier for our beloved translators; this
2008-10-12 Thomas Thurman <tthurman@gnome.org>
An attempt to make life a little easier for our beloved translators;
this has the same behaviour as before, but removes over thirty
translation strings.
* src/core/session.c (start_element_handler): all "attribute not found
on element" strings are identical
* src/ui/theme-parser.c (locate_attributes): allow attribute names to
be preceded with "!" (in the code) to show they're required.
(parse_aspect_ratio, parse_distance, parse_toplevel_element,
parse_style_element, parse_gradient_element, static, parse_border,
parse_style_set_element, parse_draw_op_element): use the new "!"
prefix for locate_attributes(), or in some cases just the identical
constant, for generating this error.
* src/ui/theme.c (check_state, meta_theme_validate): add
translator comments
* src/ui/resizepopup.c (update_size_window): add
translator comments
svn path=/trunk/; revision=3949
2008-10-12 10:34:54 -04:00
|
|
|
name, "geometry");
|
2001-07-28 02:11:15 -04:00
|
|
|
return;
|
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-28 02:11:15 -04:00
|
|
|
++i;
|
|
|
|
}
|
2001-07-27 00:22:18 -04:00
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Loaded geometry %d,%d %dx%d gravity %s",
|
2002-02-07 22:34:26 -05:00
|
|
|
pd->info->rect.x,
|
|
|
|
pd->info->rect.y,
|
|
|
|
pd->info->rect.width,
|
|
|
|
pd->info->rect.height,
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
meta_gravity_to_string (pd->info->gravity));
|
2001-07-27 00:22:18 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_set_error (error,
|
|
|
|
G_MARKUP_ERROR,
|
|
|
|
G_MARKUP_ERROR_UNKNOWN_ELEMENT,
|
2013-09-11 04:37:36 -04:00
|
|
|
"Unknown element %s",
|
2001-07-27 00:22:18 -04:00
|
|
|
element_name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
end_element_handler (GMarkupParseContext *context,
|
|
|
|
const gchar *element_name,
|
|
|
|
gpointer user_data,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
ParseData *pd;
|
|
|
|
|
|
|
|
pd = user_data;
|
|
|
|
|
|
|
|
if (strcmp (element_name, "window") == 0)
|
|
|
|
{
|
|
|
|
g_assert (pd->info);
|
|
|
|
|
|
|
|
window_info_list = g_slist_prepend (window_info_list,
|
|
|
|
pd->info);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Loaded window info from session with class: %s name: %s role: %s",
|
2002-02-07 22:34:26 -05:00
|
|
|
pd->info->res_class ? pd->info->res_class : "(none)",
|
|
|
|
pd->info->res_name ? pd->info->res_name : "(none)",
|
|
|
|
pd->info->role ? pd->info->role : "(none)");
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
pd->info = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
text_handler (GMarkupParseContext *context,
|
|
|
|
const gchar *text,
|
|
|
|
gsize text_len,
|
|
|
|
gpointer user_data,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
/* Right now we don't have any elements where we care about their
|
|
|
|
* content
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
both_null_or_matching (const char *a,
|
|
|
|
const char *b)
|
|
|
|
{
|
|
|
|
if (a == NULL && b == NULL)
|
|
|
|
return TRUE;
|
|
|
|
else if (a && b && strcmp (a, b) == 0)
|
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GSList*
|
|
|
|
get_possible_matches (MetaWindow *window)
|
|
|
|
{
|
|
|
|
/* Get all windows with this client ID */
|
|
|
|
GSList *retval;
|
|
|
|
GSList *tmp;
|
2001-07-28 02:11:15 -04:00
|
|
|
gboolean ignore_client_id;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
retval = NULL;
|
|
|
|
|
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
|
|
|
ignore_client_id = g_getenv ("MUTTER_DEBUG_SM") != NULL;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
tmp = window_info_list;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindowSessionInfo *info;
|
|
|
|
|
|
|
|
info = tmp->data;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-28 02:11:15 -04:00
|
|
|
if ((ignore_client_id ||
|
2014-05-02 09:34:02 -04:00
|
|
|
both_null_or_matching (info->id, window->sm_client_id)) &&
|
2001-07-27 00:22:18 -04:00
|
|
|
both_null_or_matching (info->res_class, window->res_class) &&
|
|
|
|
both_null_or_matching (info->res_name, window->res_name) &&
|
|
|
|
both_null_or_matching (info->role, window->role))
|
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Window %s may match saved window with class: %s name: %s role: %s",
|
2002-02-07 22:34:26 -05:00
|
|
|
window->desc,
|
|
|
|
info->res_class ? info->res_class : "(none)",
|
|
|
|
info->res_name ? info->res_name : "(none)",
|
|
|
|
info->role ? info->role : "(none)");
|
2001-07-27 00:22:18 -04:00
|
|
|
|
|
|
|
retval = g_slist_prepend (retval, info);
|
|
|
|
}
|
2001-07-27 00:36:44 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (meta_is_verbose ())
|
|
|
|
{
|
|
|
|
if (!both_null_or_matching (info->id, window->sm_client_id))
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Window %s has SM client ID %s, saved state has %s, no match",
|
2002-02-07 22:34:26 -05:00
|
|
|
window->desc,
|
|
|
|
window->sm_client_id ? window->sm_client_id : "(none)",
|
|
|
|
info->id ? info->id : "(none)");
|
2001-07-27 00:36:44 -04:00
|
|
|
else if (!both_null_or_matching (info->res_class, window->res_class))
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Window %s has class %s doesn't match saved class %s, no match",
|
2002-02-07 22:34:26 -05:00
|
|
|
window->desc,
|
|
|
|
window->res_class ? window->res_class : "(none)",
|
|
|
|
info->res_class ? info->res_class : "(none)");
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:36:44 -04:00
|
|
|
else if (!both_null_or_matching (info->res_name, window->res_name))
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Window %s has name %s doesn't match saved name %s, no match",
|
2002-02-07 22:34:26 -05:00
|
|
|
window->desc,
|
|
|
|
window->res_name ? window->res_name : "(none)",
|
|
|
|
info->res_name ? info->res_name : "(none)");
|
2001-07-27 00:36:44 -04:00
|
|
|
else if (!both_null_or_matching (info->role, window->role))
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "Window %s has role %s doesn't match saved role %s, no match",
|
2002-02-07 22:34:26 -05:00
|
|
|
window->desc,
|
|
|
|
window->role ? window->role : "(none)",
|
|
|
|
info->role ? info->role : "(none)");
|
2001-07-27 00:36:44 -04:00
|
|
|
else
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM, "???? should not happen - window %s doesn't match saved state %s for no good reason",
|
2002-02-07 22:34:26 -05:00
|
|
|
window->desc, info->id);
|
2001-07-27 00:36:44 -04:00
|
|
|
}
|
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2002-03-13 23:09:42 -05:00
|
|
|
static const MetaWindowSessionInfo*
|
2001-07-27 00:22:18 -04:00
|
|
|
find_best_match (GSList *infos,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
|
|
|
GSList *tmp;
|
|
|
|
const MetaWindowSessionInfo *matching_title;
|
|
|
|
const MetaWindowSessionInfo *matching_type;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
matching_title = NULL;
|
|
|
|
matching_type = NULL;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
tmp = infos;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindowSessionInfo *info;
|
|
|
|
|
|
|
|
info = tmp->data;
|
|
|
|
|
|
|
|
if (matching_title == NULL &&
|
|
|
|
both_null_or_matching (info->title, window->title))
|
|
|
|
matching_title = info;
|
|
|
|
|
|
|
|
if (matching_type == NULL &&
|
|
|
|
info->type == window->type)
|
|
|
|
matching_type = info;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Prefer same title, then same type of window, then
|
|
|
|
* just pick something. Eventually we could enhance this
|
|
|
|
* to e.g. break ties by geometry hint similarity,
|
|
|
|
* or other window features.
|
|
|
|
*/
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
if (matching_title)
|
|
|
|
return matching_title;
|
|
|
|
else if (matching_type)
|
|
|
|
return matching_type;
|
|
|
|
else
|
|
|
|
return infos->data;
|
|
|
|
}
|
|
|
|
|
|
|
|
const MetaWindowSessionInfo*
|
|
|
|
meta_window_lookup_saved_state (MetaWindow *window)
|
|
|
|
{
|
|
|
|
GSList *possibles;
|
|
|
|
const MetaWindowSessionInfo *info;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
/* Window is not session managed.
|
|
|
|
* I haven't yet figured out how to deal with these
|
|
|
|
* in a way that doesn't cause broken side effects in
|
|
|
|
* situations other than on session restore.
|
|
|
|
*/
|
|
|
|
if (window->sm_client_id == NULL)
|
2001-07-27 00:36:44 -04:00
|
|
|
{
|
2002-02-07 22:34:26 -05:00
|
|
|
meta_topic (META_DEBUG_SM,
|
2020-10-02 11:47:22 -04:00
|
|
|
"Window %s is not session managed, not checking for saved state",
|
2002-02-07 22:34:26 -05:00
|
|
|
window->desc);
|
2001-07-27 00:36:44 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
2001-07-26 01:10:01 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
possibles = get_possible_matches (window);
|
2001-07-26 01:10:01 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
if (possibles == NULL)
|
2001-07-27 00:36:44 -04:00
|
|
|
{
|
2020-10-02 11:47:22 -04:00
|
|
|
meta_topic (META_DEBUG_SM,
|
|
|
|
"Window %s has no possible matches in the list of saved window states",
|
2002-02-07 22:34:26 -05:00
|
|
|
window->desc);
|
2001-07-27 00:36:44 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
2001-07-27 00:22:18 -04:00
|
|
|
|
2001-07-27 00:36:44 -04:00
|
|
|
info = find_best_match (possibles, window);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
g_slist_free (possibles);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
return info;
|
2001-07-26 01:10:01 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-07-27 00:22:18 -04:00
|
|
|
meta_window_release_saved_state (const MetaWindowSessionInfo *info)
|
2001-07-26 01:10:01 -04:00
|
|
|
{
|
2001-07-27 00:22:18 -04:00
|
|
|
/* We don't want to use the same saved state again for another
|
|
|
|
* window.
|
|
|
|
*/
|
|
|
|
window_info_list = g_slist_remove (window_info_list, info);
|
|
|
|
|
|
|
|
session_info_free ((MetaWindowSessionInfo*) info);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
session_info_free (MetaWindowSessionInfo *info)
|
|
|
|
{
|
|
|
|
g_free (info->id);
|
|
|
|
g_free (info->res_class);
|
|
|
|
g_free (info->res_name);
|
|
|
|
g_free (info->title);
|
|
|
|
g_free (info->role);
|
|
|
|
|
|
|
|
g_slist_free (info->workspace_indices);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
g_free (info);
|
|
|
|
}
|
|
|
|
|
|
|
|
static MetaWindowSessionInfo*
|
|
|
|
session_info_new (void)
|
|
|
|
{
|
|
|
|
MetaWindowSessionInfo *info;
|
2001-07-26 01:10:01 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
info = g_new0 (MetaWindowSessionInfo, 1);
|
|
|
|
|
|
|
|
info->type = META_WINDOW_NORMAL;
|
2020-02-14 03:44:43 -05:00
|
|
|
info->gravity = META_GRAVITY_NORTH_WEST;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-07-27 00:22:18 -04:00
|
|
|
return info;
|
2001-06-22 02:21:44 -04:00
|
|
|
}
|
|
|
|
|
2002-03-13 23:09:42 -05:00
|
|
|
static char* full_save_path = NULL;
|
|
|
|
|
|
|
|
static void
|
|
|
|
regenerate_save_file (void)
|
|
|
|
{
|
|
|
|
g_free (full_save_path);
|
2007-03-26 17:38:19 -04:00
|
|
|
|
|
|
|
if (client_id)
|
2008-03-27 09:12:28 -04:00
|
|
|
full_save_path = g_strconcat (g_get_user_config_dir (),
|
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
|
|
|
G_DIR_SEPARATOR_S "mutter"
|
2008-03-27 09:12:28 -04:00
|
|
|
G_DIR_SEPARATOR_S "sessions" G_DIR_SEPARATOR_S,
|
2007-03-26 17:38:19 -04:00
|
|
|
client_id,
|
|
|
|
".ms",
|
|
|
|
NULL);
|
|
|
|
else
|
|
|
|
full_save_path = NULL;
|
2002-03-13 23:09:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static const char*
|
|
|
|
full_save_file (void)
|
|
|
|
{
|
|
|
|
return full_save_path;
|
|
|
|
}
|
|
|
|
|
2002-05-29 23:54:10 -04:00
|
|
|
static int
|
|
|
|
windows_cmp_by_title (MetaWindow *a,
|
|
|
|
MetaWindow *b)
|
|
|
|
{
|
|
|
|
return g_utf8_collate (a->title, b->title);
|
|
|
|
}
|
|
|
|
|
2002-07-12 23:40:05 -04:00
|
|
|
static void
|
|
|
|
finish_interact (gboolean shutdown)
|
|
|
|
{
|
|
|
|
if (current_state == STATE_DONE_WITH_INTERACT) /* paranoia */
|
|
|
|
{
|
|
|
|
SmcInteractDone (session_connection, False /* don't cancel logout */);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-07-12 23:40:05 -04:00
|
|
|
save_yourself_possibly_done (shutdown, TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-05 09:57:58 -04:00
|
|
|
static void
|
2009-11-19 17:38:06 -05:00
|
|
|
dialog_closed (GPid pid, int status, gpointer user_data)
|
2002-07-12 23:40:05 -04:00
|
|
|
{
|
2009-05-05 09:57:58 -04:00
|
|
|
gboolean shutdown = GPOINTER_TO_INT (user_data);
|
2002-07-12 23:40:05 -04:00
|
|
|
|
2009-11-19 17:38:06 -05:00
|
|
|
if (WIFEXITED (status) && WEXITSTATUS (status) == 0) /* pressed "OK" */
|
2002-07-12 23:40:05 -04:00
|
|
|
{
|
2009-05-05 09:57:58 -04:00
|
|
|
finish_interact (shutdown);
|
2003-09-24 21:50:30 -04:00
|
|
|
}
|
2002-07-12 23:40:05 -04:00
|
|
|
}
|
|
|
|
|
2002-05-29 23:54:10 -04:00
|
|
|
static void
|
2002-07-12 23:40:05 -04:00
|
|
|
warn_about_lame_clients_and_finish_interact (gboolean shutdown)
|
2002-05-29 23:54:10 -04:00
|
|
|
{
|
2009-05-05 09:57:58 -04:00
|
|
|
GSList *lame = NULL;
|
2008-04-07 16:50:37 -04:00
|
|
|
GSList *windows;
|
2009-05-05 09:57:58 -04:00
|
|
|
GSList *lame_details = NULL;
|
2002-05-29 23:54:10 -04:00
|
|
|
GSList *tmp;
|
2009-05-05 09:57:58 -04:00
|
|
|
GSList *columns = NULL;
|
2009-11-19 17:38:06 -05:00
|
|
|
GPid pid;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2009-06-15 15:32:23 -04:00
|
|
|
windows = meta_display_list_windows (meta_get_display (), META_LIST_DEFAULT);
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
tmp = windows;
|
|
|
|
while (tmp != NULL)
|
2002-05-29 23:54:10 -04:00
|
|
|
{
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
MetaWindow *window;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
window = tmp->data;
|
2002-05-29 23:54:10 -04:00
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
/* only complain about normal windows, the others
|
|
|
|
* are kind of dumb to worry about
|
|
|
|
*/
|
|
|
|
if (window->sm_client_id == NULL &&
|
|
|
|
window->type == META_WINDOW_NORMAL)
|
|
|
|
lame = g_slist_prepend (lame, window);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
tmp = tmp->next;
|
2002-05-29 23:54:10 -04:00
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
MetaDisplay becomes a singleton. The static variable which holds this
2008-03-25 Thomas Thurman <tthurman@gnome.org>
* src/core/display.c (meta_display_queue_retheme_all_windows,
meta_set_syncing, meta_display_set_cursor_theme, disable_compositor,
meta_display_for_x_display, meta_display_open, meta_display_close,
meta_display_ungrab): MetaDisplay becomes a singleton. The static
variable which holds this singleton is renamed "the_display" so as
not to mask the this parameter in the methods.
* src/core/main.c (main):
* src/core/session.c (warn_about_lame_clients_and_finish_inte,
save_state, io_from_warning_dialog):
* src/core/core.c (meta_core_increment_event_serial):
* src/core/delete.c (release_window_with_fd, search_and_destroy_window):
sympathy changes for this, and consequent simplification.
Closes #499301.
svn path=/trunk/; revision=3663
2008-03-24 23:39:13 -04:00
|
|
|
g_slist_free (windows);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-07-12 23:47:06 -04:00
|
|
|
if (lame == NULL)
|
|
|
|
{
|
|
|
|
/* No lame apps. */
|
|
|
|
finish_interact (shutdown);
|
|
|
|
return;
|
|
|
|
}
|
2002-05-29 23:54:10 -04:00
|
|
|
|
2015-09-23 19:13:59 -04:00
|
|
|
columns = g_slist_prepend (columns, (gpointer)"Window");
|
|
|
|
columns = g_slist_prepend (columns, (gpointer)"Class");
|
2004-08-25 20:59:12 -04:00
|
|
|
|
2009-05-05 09:57:58 -04:00
|
|
|
lame = g_slist_sort (lame, (GCompareFunc) windows_cmp_by_title);
|
2002-05-29 23:54:10 -04:00
|
|
|
|
|
|
|
tmp = lame;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *w = tmp->data;
|
|
|
|
|
2009-05-05 09:57:58 -04:00
|
|
|
lame_details = g_slist_prepend (lame_details,
|
2015-09-23 19:13:59 -04:00
|
|
|
w->res_class ? w->res_class : (gpointer)"");
|
2009-05-05 09:57:58 -04:00
|
|
|
lame_details = g_slist_prepend (lame_details,
|
|
|
|
w->title);
|
2002-05-29 23:54:10 -04:00
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
2009-05-05 09:57:58 -04:00
|
|
|
g_slist_free (lame);
|
2002-07-12 23:40:05 -04:00
|
|
|
|
2009-11-19 17:38:06 -05:00
|
|
|
pid = meta_show_dialog("--list",
|
2016-09-29 18:56:23 -04:00
|
|
|
_("These windows do not support “save current setup” "
|
2009-11-19 17:38:06 -05:00
|
|
|
"and will have to be restarted manually next time "
|
|
|
|
"you log in."),
|
|
|
|
"240",
|
2017-08-26 12:26:30 -04:00
|
|
|
meta_get_display()->x11_display->screen_name,
|
2012-09-18 16:57:26 -04:00
|
|
|
NULL, NULL, NULL,
|
2009-11-19 17:38:06 -05:00
|
|
|
None,
|
|
|
|
columns,
|
|
|
|
lame_details);
|
2002-05-29 23:54:10 -04:00
|
|
|
|
2009-05-05 09:57:58 -04:00
|
|
|
g_slist_free (lame_details);
|
|
|
|
|
2009-11-19 17:38:06 -05:00
|
|
|
g_child_watch_add (pid, dialog_closed, GINT_TO_POINTER (shutdown));
|
2002-05-29 23:54:10 -04:00
|
|
|
}
|
|
|
|
|
2001-06-22 02:21:44 -04:00
|
|
|
#endif /* HAVE_SM */
|