Commit b43a21a7 authored by Sean Davis's avatar Sean Davis

Move external MATE dependencies in to begin port

parent c0038c07
......@@ -34,7 +34,7 @@
* NEWS: use consistent, project wide, markdown-like formatting to make
generating release announcements easier
* Build: require libmate-menu >= 1.10
* Build: require libmatekbd and libmate-desktop >= 1.17
* Build: require libxfcekbd and libmate-desktop >= 1.17
* Move to GTK+3 (require GTK+ >= 3.14), drop GTK+2 code and --with-gtk
build option
* Lock screen: load user's background instead of system one
......@@ -92,7 +92,7 @@
### mate-screensaver 1.10.0
* Update to api changes for MateRR* in mate-desktop (thanks monsta for testing)
* Update to api changes for XfceRR* in mate-desktop (thanks monsta for testing)
### mate-screensaver 1.8.0
......
......@@ -47,9 +47,7 @@ DBUS_REQUIRED_VERSION=0.30
GLIB_REQUIRED_VERSION=2.50.0
GTK_REQUIRED_VERSION=3.22.0
X11_REQUIRED_VERSION=1.0
LIBMATE_MENU_REQUIRED_VERSION=1.10.0
MATE_DESKTOP_REQUIRED_VERSION=1.17.0
LIBMATEKBDUI_REQUIRED_VERSION=1.17.0
LIBXKLAVIER_REQUIRED=5.2
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(crypt.h sys/select.h)
......@@ -65,24 +63,21 @@ PKG_CHECK_MODULES(MATE_SCREENSAVER,
gtk+-3.0 >= $GTK_REQUIRED_VERSION
dbus-glib-1 >= $DBUS_REQUIRED_VERSION
gio-2.0 >= $GLIB_REQUIRED_VERSION
mate-desktop-2.0 >= $MATE_DESKTOP_REQUIRED_VERSION
libmate-menu >= $LIBMATE_MENU_REQUIRED_VERSION)
libxklavier >= $LIBXKLAVIER_REQUIRED)
AC_SUBST(MATE_SCREENSAVER_CFLAGS)
AC_SUBST(MATE_SCREENSAVER_LIBS)
PKG_CHECK_MODULES(MATE_SCREENSAVER_DIALOG,
gio-2.0 >= $GLIB_REQUIRED_VERSION
gthread-2.0
gtk+-3.0 >= $GTK_REQUIRED_VERSION
mate-desktop-2.0 >= $MATE_DESKTOP_REQUIRED_VERSION)
gtk+-3.0 >= $GTK_REQUIRED_VERSION)
AC_SUBST(MATE_SCREENSAVER_DIALOG_CFLAGS)
AC_SUBST(MATE_SCREENSAVER_DIALOG_LIBS)
PKG_CHECK_MODULES(MATE_SCREENSAVER_CAPPLET,
gio-2.0 >= $GLIB_REQUIRED_VERSION
gtk+-3.0 >= $GTK_REQUIRED_VERSION
mate-desktop-2.0 >= $MATE_DESKTOP_REQUIRED_VERSION
libmate-menu >= $LIBMATE_MENU_REQUIRED_VERSION)
libxklavier >= $LIBXKLAVIER_REQUIRED)
AC_SUBST(MATE_SCREENSAVER_CAPPLET_CFLAGS)
AC_SUBST(MATE_SCREENSAVER_CAPPLET_LIBS)
......@@ -946,18 +941,13 @@ AC_SUBST(SYSTEMD_CFLAGS)
AC_SUBST(SYSTEMD_LIBS)
dnl ---------------------------------------------------------------------------
dnl libmatekbd
dnl libxfcekbd
dnl ---------------------------------------------------------------------------
have_libmatekbdui=no
have_libxfcekbdui=no
AC_ARG_WITH(kbd-layout-indicator,[ --without-kbd-layout-indicator disable keyboard layout indicator],
[with_kbd_layout_indicator="$withval"],[with_kbd_layout_indicator=yes])
if test x$with_kbd_layout_indicator != xno; then
PKG_CHECK_MODULES(LIBMATEKBDUI, libmatekbdui >= $LIBMATEKBDUI_REQUIRED_VERSION, have_libmatekbdui=yes, have_libmatekbdui=no)
fi
if test "x$have_libmatekbdui" = "xyes"; then
AC_SUBST(LIBMATEKBDUI_CFLAGS)
AC_SUBST(LIBMATEKBDUI_LIBS)
AC_DEFINE(WITH_KBD_LAYOUT_INDICATOR, 1, [Define if keyboard layout indicator should be built])
fi
......@@ -1086,6 +1076,7 @@ fi
AC_SUBST(DEBUG_CFLAGS)
# Flags
CFLAGS="$CFLAGS -lm"
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
......
......@@ -31,6 +31,7 @@ AM_CPPFLAGS = \
$(DBUS_CFLAGS) \
$(LIBMATEKBDUI_CFLAGS) \
$(LIBNOTIFY_CFLAGS) \
$(LIBXKLAVIER_CFLAGS) \
$(SYSTEMD_CFLAGS) \
$(NULL)
......@@ -76,6 +77,8 @@ test_fade_SOURCES = \
gs-fade.h \
gs-debug.c \
gs-debug.h \
xfce-rr.c \
xfce-rr.h \
$(NULL)
test_fade_LDADD = \
......@@ -141,6 +144,31 @@ mate_screensaver_dialog_SOURCES = \
setuid.h \
subprocs.c \
subprocs.h \
xfce-desktop-utils.c \
xfce-desktop-utils.h \
xfcekbd-indicator.c \
xfcekbd-indicator.h \
xfcekbd-indicator-config.c \
xfcekbd-indicator-config.h \
xfcekbd-config-private.h \
xfcekbd-desktop-config.c \
xfcekbd-desktop-config.h \
xfcekbd-keyboard-config.c \
xfcekbd-keyboard-config.h \
xfcekbd-util.c \
xfcekbd-util.h \
desktop-entries.c \
desktop-entries.h \
menu-layout.c \
menu-layout.h \
menu-util.c \
menu-util.h \
menu-monitor.c \
menu-monitor.h \
canonicalize.c \
canonicalize.h \
entry-directories.c \
entry-directories.h \
$(AUTH_SOURCES) \
$(NULL)
......@@ -149,10 +177,36 @@ EXTRA_mate_screensaver_dialog_SOURCES = \
gs-auth-helper.c \
gs-auth-pwent.c \
gs-auth-bsdauth.c \
xfce-desktop-utils.c \
xfce-desktop-utils.h \
xfcekbd-indicator.c \
xfcekbd-indicator.h \
xfcekbd-indicator-config.c \
xfcekbd-indicator-config.h \
xfcekbd-config-private.h \
xfcekbd-desktop-config.c \
xfcekbd-desktop-config.h \
xfcekbd-keyboard-config.c \
xfcekbd-keyboard-config.h \
xfcekbd-util.c \
xfcekbd-util.h \
desktop-entries.c \
desktop-entries.h \
menu-layout.c \
menu-layout.h \
menu-util.c \
menu-util.h \
menu-monitor.c \
menu-monitor.h \
canonicalize.c \
canonicalize.h \
entry-directories.c \
entry-directories.h \
$(NULL)
mate_screensaver_dialog_LDADD = \
$(MATE_SCREENSAVER_DIALOG_LIBS)\
$(MATE_SCREENSAVER_LIBS)\
$(SAVER_LIBS) \
$(AUTH_LIBS) \
$(LIBMATEKBDUI_LIBS) \
......@@ -162,6 +216,7 @@ mate_screensaver_dialog_LDADD = \
BUILT_SOURCES = \
gs-marshal.c \
gs-marshal.h \
xfcekbd-indicator-marshal.h \
$(NULL)
gs-marshal.c: gs-marshal.list
......@@ -198,6 +253,42 @@ mate_screensaver_SOURCES = \
gs-grab.h \
gs-fade.c \
gs-fade.h \
xfce-rr.c \
xfce-rr.h \
xfce-bg.c \
xfce-bg.h \
xfce-bg-crossfade.c \
xfce-bg-crossfade.h \
xfce-desktop-thumbnail.c \
xfce-desktop-thumbnail.h \
xfce-desktop-utils.c \
xfce-desktop-utils.h \
xfcekbd-indicator.c \
xfcekbd-indicator.h \
xfcekbd-indicator-config.c \
xfcekbd-indicator-config.h \
xfcekbd-config-private.h \
xfcekbd-desktop-config.c \
xfcekbd-desktop-config.h \
xfcekbd-keyboard-config.c \
xfcekbd-keyboard-config.h \
xfcekbd-util.c \
xfcekbd-util.h \
xfcemenu-tree.c \
xfcemenu-tree.h \
desktop-entries.c \
desktop-entries.h \
menu-layout.c \
menu-layout.h \
menu-util.c \
menu-util.h \
menu-monitor.c \
menu-monitor.h \
canonicalize.c \
canonicalize.h \
entry-directories.c \
entry-directories.h \
private.h \
$(BUILT_SOURCES) \
$(NULL)
......@@ -232,6 +323,33 @@ mate_screensaver_preferences_SOURCES = \
gs-debug.h \
subprocs.c \
subprocs.h \
xfce-desktop-utils.c \
xfce-desktop-utils.h \
xfcekbd-indicator.c \
xfcekbd-indicator.h \
xfcekbd-indicator-config.c \
xfcekbd-indicator-config.h \
xfcekbd-config-private.h \
xfcekbd-desktop-config.c \
xfcekbd-desktop-config.h \
xfcekbd-keyboard-config.c \
xfcekbd-keyboard-config.h \
xfcekbd-util.c \
xfcekbd-util.h \
xfcemenu-tree.c \
xfcemenu-tree.h \
canonicalize.c \
canonicalize.h \
entry-directories.c \
entry-directories.h \
menu-util.c \
menu-util.h \
menu-layout.c \
menu-layout.h \
menu-monitor.c \
menu-monitor.h \
desktop-entries.c \
desktop-entries.h \
$(NULL)
mate_screensaver_preferences_LDADD = \
......@@ -244,6 +362,14 @@ EXTRA_DIST = \
mate-screensaver.desktop.in \
$(NULL)
GLIB_GENMARSHAL = $(shell pkg-config --variable=glib_genmarshal glib-2.0)
xfcekbd-indicator-marshal.h: xfcekbd-indicator-marshal.list
$(AM_V_GEN)$(GLIB_GENMARSHAL) --prefix=xfcekbd_indicator $(srcdir)/xfcekbd-indicator-marshal.list --header > $@
xfcekbd-indicator-marshal.c: xfcekbd-indicator-marshal.h
$(AM_V_GEN)$(GLIB_GENMARSHAL) --prefix=xfcekbd_indicator $(srcdir)/xfcekbd-indicator-marshal.list --body > $@
CLEANFILES = \
$(desktop_DATA) \
mate-screensaver.desktop.in \
......
/* Return the canonical absolute name of a given file.
* Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
* This file is part of the GNU C Library.
*
* Copyright (C) 2002 Red Hat, Inc. (trivial port to GLib)
*
* The GNU C Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* The GNU C Library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the GNU C Library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
#include <config.h>
#include "canonicalize.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <errno.h>
#include <stddef.h>
#ifndef MAXSYMLINKS
#define MAXSYMLINKS sysconf(_SC_SYMLOOP_MAX)
#endif
/* Return the canonical absolute name of file NAME. A canonical name
does not contain any `.', `..' components nor any repeated path
separators ('/') or symlinks. All path components must exist. If
RESOLVED is null, the result is malloc'd; otherwise, if the
canonical name is PATH_MAX chars or more, returns null with `errno'
set to ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars,
returns the name in RESOLVED. If the name cannot be resolved and
RESOLVED is non-NULL, it contains the path of the first component
that cannot be resolved. If the path can be resolved, RESOLVED
holds the same value as the value returned. */
static char* menu_realpath(const char* name, char* resolved)
{
char* rpath = NULL;
char* dest = NULL;
char* extra_buf = NULL;
const char* start;
const char* end;
const char* rpath_limit;
long int path_max;
int num_links = 0;
if (name == NULL)
{
/* As per Single Unix Specification V2 we must return an error if
* either parameter is a null pointer. We extend this to allow
* the RESOLVED parameter to be NULL in case the we are expected to
* allocate the room for the return value. */
errno = EINVAL;
return NULL;
}
if (name[0] == '\0')
{
/* As per Single Unix Specification V2 we must return an error if
* the name argument points to an empty string. */
errno = ENOENT;
return NULL;
}
#ifdef PATH_MAX
path_max = PATH_MAX;
#else
path_max = pathconf(name, _PC_PATH_MAX);
if (path_max <= 0)
{
path_max = 1024;
}
#endif
rpath = resolved ? g_alloca(path_max) : g_malloc(path_max);
rpath_limit = rpath + path_max;
if (name[0] != G_DIR_SEPARATOR)
{
if (!getcwd(rpath, path_max))
{
rpath[0] = '\0';
goto error;
}
dest = strchr(rpath, '\0');
}
else
{
rpath[0] = G_DIR_SEPARATOR;
dest = rpath + 1;
}
for (start = end = name; *start; start = end)
{
struct stat st;
int n;
/* Skip sequence of multiple path-separators. */
while (*start == G_DIR_SEPARATOR)
{
++start;
}
/* Find end of path component. */
for (end = start; *end && *end != G_DIR_SEPARATOR; ++end)
{
/* Nothing. */;
}
if (end - start == 0)
{
break;
}
else if (end - start == 1 && start[0] == '.')
{
/* nothing */;
}
else if (end - start == 2 && start[0] == '.' && start[1] == '.')
{
/* Back up to previous component, ignore if at root already. */
if (dest > rpath + 1)
{
while ((--dest)[-1] != G_DIR_SEPARATOR)
{
/* Nothing. */;
}
}
}
else
{
size_t new_size;
if (dest[-1] != G_DIR_SEPARATOR)
{
*dest++ = G_DIR_SEPARATOR;
}
if (dest + (end - start) >= rpath_limit)
{
char* new_rpath;
ptrdiff_t dest_offset = dest - rpath;
if (resolved)
{
#ifdef ENAMETOOLONG
errno = ENAMETOOLONG;
#else
/* Uh... just pick something */
errno = EINVAL;
#endif
if (dest > rpath + 1)
{
dest--;
}
*dest = '\0';
goto error;
}
new_size = rpath_limit - rpath;
if (end - start + 1 > path_max)
{
new_size += end - start + 1;
}
else
{
new_size += path_max;
}
new_rpath = (char*) realloc(rpath, new_size);
if (new_rpath == NULL)
{
goto error;
}
rpath = new_rpath;
rpath_limit = rpath + new_size;
dest = rpath + dest_offset;
}
memcpy(dest, start, end - start);
dest = dest + (end - start);
*dest = '\0';
if (stat(rpath, &st) < 0)
{
goto error;
}
if (S_ISLNK(st.st_mode))
{
char* buf = alloca(path_max);
size_t len;
if (++num_links > MAXSYMLINKS)
{
errno = ELOOP;
goto error;
}
n = readlink(rpath, buf, path_max);
if (n < 0)
{
goto error;
}
buf[n] = '\0';
if (!extra_buf)
{
extra_buf = g_alloca(path_max);
}
len = strlen(end);
if ((long int) (n + len) >= path_max)
{
#ifdef ENAMETOOLONG
errno = ENAMETOOLONG;
#else
/* Uh... just pick something */
errno = EINVAL;
#endif
goto error;
}
/* Careful here, end may be a pointer into extra_buf... */
g_memmove(&extra_buf[n], end, len + 1);
name = end = memcpy(extra_buf, buf, n);
if (buf[0] == G_DIR_SEPARATOR)
{
dest = rpath + 1; /* It's an absolute symlink */
}
else
{
/* Back up to previous component, ignore if at root already: */
if (dest > rpath + 1)
{
while ((--dest)[-1] != G_DIR_SEPARATOR)
{
/* Nothing. */;
}
}
}
}
}
}
if (dest > rpath + 1 && dest[-1] == G_DIR_SEPARATOR)
{
--dest;
}
*dest = '\0';
return resolved ? memcpy(resolved, rpath, dest - rpath + 1) : rpath;
error:
if (resolved)
{
strcpy(resolved, rpath);
}
else
{
g_free(rpath);
}
return NULL;
}
char* menu_canonicalize_file_name(const char* name, gboolean allow_missing_basename)
{
char* retval;
retval = menu_realpath(name, NULL);
/* We could avoid some system calls by using the second
* argument to realpath() instead of doing realpath
* all over again, but who cares really. we'll see if
* it's ever in a profile.
*/
if (allow_missing_basename && retval == NULL)
{
char* dirname;
char* canonical_dirname;
dirname = g_path_get_dirname(name);
canonical_dirname = menu_realpath(dirname, NULL);
g_free(dirname);
if (canonical_dirname)
{
char* basename;
basename = g_path_get_basename(name);
retval = g_build_filename(canonical_dirname, basename, NULL);
g_free(basename);
g_free(canonical_dirname);
}
}
return retval;
}
/* Return the canonical absolute name of a given file.
* Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
* This file is part of the GNU C Library.
*
* Copyright (C) 2002 Red Hat, Inc. (trivial port to GLib)
*
* The GNU C Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* The GNU C Library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the GNU C Library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
#ifndef G_CANONICALIZE_H
#define G_CANONICALIZE_H
#include <glib.h>
#ifdef __cplusplus
extern "C" {
#endif
char* menu_canonicalize_file_name(const char* name, gboolean allow_missing_basename);
#ifdef __cplusplus