build: Isolate smclient
parent
47f8325d02
commit
f42878c7f6
24
configure.ac
24
configure.ac
|
@ -57,7 +57,28 @@ PKG_CHECK_MODULES([TERM],
|
||||||
# smclient
|
# smclient
|
||||||
# ********
|
# ********
|
||||||
|
|
||||||
PKG_CHECK_MODULES(SMCLIENT, sm >= 1.0.0)
|
# $enable_xsmp will be set to "yes" or "no"
|
||||||
|
AC_ARG_ENABLE(smclient,
|
||||||
|
[AC_HELP_STRING([--enable-smclient],
|
||||||
|
[Explicitly enable or disable smclient])],
|
||||||
|
[enable_smclient=$enableval],
|
||||||
|
[enable_smclient=yes])
|
||||||
|
|
||||||
|
have_sm=no
|
||||||
|
if test "x$enable_smclient" != "xno"; then
|
||||||
|
PKG_CHECK_MODULES(SMCLIENT, sm >= 1.0.0, have_sm=yes, [
|
||||||
|
if test "x$enable_smclient" = "xyes"; then
|
||||||
|
AC_MSG_ERROR([smclient enabled but SM library not found])
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AM_CONDITIONAL(ENABLE_SMCLIENT, [test "x$have_sm" = "xyes"])
|
||||||
|
|
||||||
|
if test "x$have_sm" = "xyes"; then
|
||||||
|
AC_DEFINE(HAVE_SMCLIENT, 1, [Have the SM development library])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_SUBST([SMCLIENT_CFLAGS])
|
AC_SUBST([SMCLIENT_CFLAGS])
|
||||||
AC_SUBST([SMCLIENT_LIBS])
|
AC_SUBST([SMCLIENT_LIBS])
|
||||||
|
|
||||||
|
@ -150,5 +171,6 @@ echo "
|
||||||
warning flags: ${WARN_CFLAGS}
|
warning flags: ${WARN_CFLAGS}
|
||||||
linker flags: ${LDFLAGS}
|
linker flags: ${LDFLAGS}
|
||||||
|
|
||||||
|
smclient support: ${have_sm}
|
||||||
s/key support: ${enable_skey}
|
s/key support: ${enable_skey}
|
||||||
"
|
"
|
||||||
|
|
|
@ -97,6 +97,7 @@ mate_terminal_LDADD += \
|
||||||
skey/libskey.la
|
skey/libskey.la
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if ENABLE_SMCLIENT
|
||||||
mate_terminal_SOURCES += \
|
mate_terminal_SOURCES += \
|
||||||
eggdesktopfile.c \
|
eggdesktopfile.c \
|
||||||
eggdesktopfile.h \
|
eggdesktopfile.h \
|
||||||
|
@ -109,6 +110,7 @@ mate_terminal_SOURCES += \
|
||||||
mate_terminal_CFLAGS += $(SMCLIENT_CFLAGS)
|
mate_terminal_CFLAGS += $(SMCLIENT_CFLAGS)
|
||||||
mate_terminal_CPPFLAGS += -DEGG_SM_CLIENT_BACKEND_XSMP
|
mate_terminal_CPPFLAGS += -DEGG_SM_CLIENT_BACKEND_XSMP
|
||||||
mate_terminal_LDADD += $(SMCLIENT_LIBS)
|
mate_terminal_LDADD += $(SMCLIENT_LIBS)
|
||||||
|
endif
|
||||||
|
|
||||||
TYPES_H_FILES = \
|
TYPES_H_FILES = \
|
||||||
terminal-profile.h \
|
terminal-profile.h \
|
||||||
|
|
|
@ -41,8 +41,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_SMCLIENT
|
||||||
#include "eggsmclient.h"
|
#include "eggsmclient.h"
|
||||||
#include "eggdesktopfile.h"
|
#include "eggdesktopfile.h"
|
||||||
|
#endif /* HAVE_SMCLIENT */
|
||||||
|
|
||||||
#define FALLBACK_PROFILE_ID "default"
|
#define FALLBACK_PROFILE_ID "default"
|
||||||
|
|
||||||
|
@ -1376,6 +1378,7 @@ terminal_app_manage_profiles (TerminalApp *app,
|
||||||
gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog));
|
gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_SMCLIENT
|
||||||
static void
|
static void
|
||||||
terminal_app_save_state_cb (EggSMClient *client,
|
terminal_app_save_state_cb (EggSMClient *client,
|
||||||
GKeyFile *key_file,
|
GKeyFile *key_file,
|
||||||
|
@ -1390,6 +1393,7 @@ terminal_app_client_quit_cb (EggSMClient *client,
|
||||||
{
|
{
|
||||||
g_signal_emit (app, signals[QUIT], 0);
|
g_signal_emit (app, signals[QUIT], 0);
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_SMCLIENT */
|
||||||
|
|
||||||
/* Class implementation */
|
/* Class implementation */
|
||||||
|
|
||||||
|
@ -1470,6 +1474,7 @@ terminal_app_init (TerminalApp *app)
|
||||||
|
|
||||||
terminal_accels_init ();
|
terminal_accels_init ();
|
||||||
|
|
||||||
|
#ifdef HAVE_SMCLIENT
|
||||||
EggSMClient *sm_client;
|
EggSMClient *sm_client;
|
||||||
char *desktop_file;
|
char *desktop_file;
|
||||||
|
|
||||||
|
@ -1485,6 +1490,7 @@ terminal_app_init (TerminalApp *app)
|
||||||
G_CALLBACK (terminal_app_save_state_cb), app);
|
G_CALLBACK (terminal_app_save_state_cb), app);
|
||||||
g_signal_connect (sm_client, "quit",
|
g_signal_connect (sm_client, "quit",
|
||||||
G_CALLBACK (terminal_app_client_quit_cb), app);
|
G_CALLBACK (terminal_app_client_quit_cb), app);
|
||||||
|
#endif /* HAVE_SMCLIENT */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1492,11 +1498,13 @@ terminal_app_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
TerminalApp *app = TERMINAL_APP (object);
|
TerminalApp *app = TERMINAL_APP (object);
|
||||||
|
|
||||||
|
#ifdef HAVE_SMCLIENT
|
||||||
EggSMClient *sm_client;
|
EggSMClient *sm_client;
|
||||||
|
|
||||||
sm_client = egg_sm_client_get ();
|
sm_client = egg_sm_client_get ();
|
||||||
g_signal_handlers_disconnect_matched (sm_client, G_SIGNAL_MATCH_DATA,
|
g_signal_handlers_disconnect_matched (sm_client, G_SIGNAL_MATCH_DATA,
|
||||||
0, 0, NULL, NULL, app);
|
0, 0, NULL, NULL, app);
|
||||||
|
#endif /* HAVE_SMCLIENT */
|
||||||
|
|
||||||
g_signal_handlers_disconnect_by_func (settings_global,
|
g_signal_handlers_disconnect_by_func (settings_global,
|
||||||
G_CALLBACK(terminal_app_profile_list_notify_cb),
|
G_CALLBACK(terminal_app_profile_list_notify_cb),
|
||||||
|
@ -1741,6 +1749,7 @@ terminal_app_handle_options (TerminalApp *app,
|
||||||
/* fall-through on success */
|
/* fall-through on success */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_SMCLIENT
|
||||||
EggSMClient *sm_client;
|
EggSMClient *sm_client;
|
||||||
|
|
||||||
sm_client = egg_sm_client_get ();
|
sm_client = egg_sm_client_get ();
|
||||||
|
@ -1754,6 +1763,7 @@ terminal_app_handle_options (TerminalApp *app,
|
||||||
!terminal_options_merge_config (options, key_file, SOURCE_SESSION, error))
|
!terminal_options_merge_config (options, key_file, SOURCE_SESSION, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_SMCLIENT */
|
||||||
|
|
||||||
/* Make sure we open at least one window */
|
/* Make sure we open at least one window */
|
||||||
terminal_options_ensure_window (options);
|
terminal_options_ensure_window (options);
|
||||||
|
|
|
@ -34,7 +34,9 @@
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_SMCLIENT
|
||||||
#include "eggsmclient.h"
|
#include "eggsmclient.h"
|
||||||
|
#endif /* HAVE_SMCLIENT */
|
||||||
|
|
||||||
#include "terminal-accels.h"
|
#include "terminal-accels.h"
|
||||||
#include "terminal-app.h"
|
#include "terminal-app.h"
|
||||||
|
@ -406,79 +408,6 @@ name_lost_cb (GDBusConnection *connection,
|
||||||
gtk_main_quit ();
|
gtk_main_quit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Settings storage works as follows:
|
|
||||||
* /apps/mate-terminal/global/
|
|
||||||
* /apps/mate-terminal/profiles/Foo/
|
|
||||||
*
|
|
||||||
* It's somewhat tricky to manage the profiles/ dir since we need to track
|
|
||||||
* the list of profiles, but GSettings doesn't have a concept of notifying that
|
|
||||||
* a directory has appeared or disappeared.
|
|
||||||
*
|
|
||||||
* Session state is stored entirely in the RestartCommand command line.
|
|
||||||
*
|
|
||||||
* The number one rule: all stored information is EITHER per-session,
|
|
||||||
* per-profile, or set from a command line option. THERE CAN BE NO
|
|
||||||
* OVERLAP. The UI and implementation totally break if you overlap
|
|
||||||
* these categories. See mate-terminal 1.x for why.
|
|
||||||
*
|
|
||||||
* Don't use this code as an example of how to use GSettings - it's hugely
|
|
||||||
* overcomplicated due to the profiles stuff. Most apps should not
|
|
||||||
* have to do scary things of this nature, and should not have
|
|
||||||
* a profiles feature.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Copied from libcaja/caja-program-choosing.c; Needed in case
|
|
||||||
* we have no DESKTOP_STARTUP_ID (with its accompanying timestamp).
|
|
||||||
*/
|
|
||||||
static Time
|
|
||||||
slowly_and_stupidly_obtain_timestamp (Display *xdisplay)
|
|
||||||
{
|
|
||||||
Window xwindow;
|
|
||||||
XEvent event;
|
|
||||||
|
|
||||||
{
|
|
||||||
XSetWindowAttributes attrs;
|
|
||||||
Atom atom_name;
|
|
||||||
Atom atom_type;
|
|
||||||
const char *name;
|
|
||||||
|
|
||||||
attrs.override_redirect = True;
|
|
||||||
attrs.event_mask = PropertyChangeMask | StructureNotifyMask;
|
|
||||||
|
|
||||||
xwindow =
|
|
||||||
XCreateWindow (xdisplay,
|
|
||||||
RootWindow (xdisplay, 0),
|
|
||||||
-100, -100, 1, 1,
|
|
||||||
0,
|
|
||||||
CopyFromParent,
|
|
||||||
CopyFromParent,
|
|
||||||
(Visual *)CopyFromParent,
|
|
||||||
CWOverrideRedirect | CWEventMask,
|
|
||||||
&attrs);
|
|
||||||
|
|
||||||
atom_name = XInternAtom (xdisplay, "WM_NAME", TRUE);
|
|
||||||
g_assert (atom_name != None);
|
|
||||||
atom_type = XInternAtom (xdisplay, "STRING", TRUE);
|
|
||||||
g_assert (atom_type != None);
|
|
||||||
|
|
||||||
name = "Fake Window";
|
|
||||||
XChangeProperty (xdisplay,
|
|
||||||
xwindow, atom_name,
|
|
||||||
atom_type,
|
|
||||||
8, PropModeReplace, (unsigned char *)name, strlen (name));
|
|
||||||
}
|
|
||||||
|
|
||||||
XWindowEvent (xdisplay,
|
|
||||||
xwindow,
|
|
||||||
PropertyChangeMask,
|
|
||||||
&event);
|
|
||||||
|
|
||||||
XDestroyWindow(xdisplay, xwindow);
|
|
||||||
|
|
||||||
return event.xproperty.time;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
get_factory_name_for_display (const char *display_name)
|
get_factory_name_for_display (const char *display_name)
|
||||||
{
|
{
|
||||||
|
@ -529,8 +458,7 @@ main (int argc, char **argv)
|
||||||
int i;
|
int i;
|
||||||
char **argv_copy;
|
char **argv_copy;
|
||||||
int argc_copy;
|
int argc_copy;
|
||||||
const char *startup_id, *display_name, *home_dir;
|
const char *startup_id, *home_dir;
|
||||||
GdkDisplay *display;
|
|
||||||
TerminalOptions *options;
|
TerminalOptions *options;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
char *working_directory;
|
char *working_directory;
|
||||||
|
@ -574,8 +502,10 @@ main (int argc, char **argv)
|
||||||
FALSE,
|
FALSE,
|
||||||
&argc, &argv,
|
&argc, &argv,
|
||||||
&error,
|
&error,
|
||||||
|
#ifdef HAVE_SMCLIENT
|
||||||
gtk_get_option_group (TRUE),
|
gtk_get_option_group (TRUE),
|
||||||
egg_sm_client_get_option_group (),
|
egg_sm_client_get_option_group (),
|
||||||
|
#endif /* HAVE_SMCLIENT */
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_free (working_directory);
|
g_free (working_directory);
|
||||||
|
@ -596,20 +526,15 @@ main (int argc, char **argv)
|
||||||
g_unsetenv ("GIO_LAUNCHED_DESKTOP_FILE_PID");
|
g_unsetenv ("GIO_LAUNCHED_DESKTOP_FILE_PID");
|
||||||
g_unsetenv ("GIO_LAUNCHED_DESKTOP_FILE");
|
g_unsetenv ("GIO_LAUNCHED_DESKTOP_FILE");
|
||||||
|
|
||||||
display = gdk_display_get_default ();
|
|
||||||
display_name = gdk_display_get_name (display);
|
|
||||||
options->display_name = g_strdup (display_name);
|
|
||||||
|
|
||||||
if (options->startup_id == NULL)
|
if (options->startup_id == NULL)
|
||||||
{
|
{
|
||||||
/* Create a fake one containing a timestamp that we can use */
|
options->startup_id = g_strdup_printf ("_TIME%lu", g_get_monotonic_time () / 1000);
|
||||||
Time timestamp;
|
|
||||||
|
|
||||||
timestamp = slowly_and_stupidly_obtain_timestamp (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
|
|
||||||
|
|
||||||
options->startup_id = g_strdup_printf ("_TIME%lu", timestamp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gdk_init (&argc, &argv);
|
||||||
|
const char *display_name = gdk_display_get_name (gdk_display_get_default ());
|
||||||
|
options->display_name = g_strdup (display_name);
|
||||||
|
|
||||||
if (options->use_factory)
|
if (options->use_factory)
|
||||||
{
|
{
|
||||||
OwnData *data;
|
OwnData *data;
|
||||||
|
@ -644,7 +569,7 @@ main (int argc, char **argv)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
gtk_init(&argc, &argv);
|
||||||
terminal_app_handle_options (terminal_app_get (), options, TRUE /* allow resume */, &error);
|
terminal_app_handle_options (terminal_app_get (), options, TRUE /* allow resume */, &error);
|
||||||
terminal_options_free (options);
|
terminal_options_free (options);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue