[Xfce4-commits] [apps/xfce4-screensaver] 327/425: Add RANDER support, drop unused definitions
noreply at xfce.org
noreply at xfce.org
Mon Oct 15 01:52:54 CEST 2018
This is an automated email from the git hooks/post-receive script.
b l u e s a b r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/xfce4-screensaver.
commit 711cd10e296bcb0b1859a258c5118e43a924d068
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Sun Sep 30 21:51:24 2018 -0400
Add RANDER support, drop unused definitions
---
.gitignore | 59 +++++++++
configure.ac | 21 +++-
src/xfce-desktop-thumbnail.c | 281 -------------------------------------------
3 files changed, 79 insertions(+), 282 deletions(-)
diff --git a/.gitignore b/.gitignore
index db3120d..7eed966 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,62 @@ po/Makefile.in.in
savers/Makefile.in
src/.deps/
src/Makefile.in
+Makefile
+config.h
+config.log
+config.status
+data/Makefile
+data/images/Makefile
+data/images/cosmos/Makefile
+data/images/cosmos/background-1.xml
+data/images/cosmos/cosmos.xml
+data/images/cosmos/cosmos.xml.in
+data/org.mate.ScreenSaver.service
+data/org.mate.screensaver.gschema.valid
+data/org.mate.screensaver.gschema.xml
+data/xfce4-screensaver-preferences.desktop
+data/xfce4-screensaver.directory
+data/xfce4-screensaver.pc
+data/xfce4-screensavers.menu
+doc/Makefile
+doc/xfce4-screensaver.xml
+libtool
+po/.intltool-merge-cache
+po/Makefile
+po/POTFILES
+po/stamp-it
+*.gmo
+savers/.deps/
+savers/Makefile
+savers/cosmos-slideshow.desktop
+savers/cosmos-slideshow.desktop.in
+savers/floaters
+savers/footlogo-floaters.desktop
+savers/footlogo-floaters.desktop.in
+savers/gnomelogo-floaters.desktop
+savers/gnomelogo-floaters.desktop.in
+savers/gs-theme-engine-marshal.c
+savers/gs-theme-engine-marshal.h
+savers/libgs-theme-engine.a
+savers/personal-slideshow.desktop
+savers/personal-slideshow.desktop.in
+savers/popsquares
+savers/popsquares.desktop
+savers/popsquares.desktop.in
+savers/slideshow
+src/Makefile
+src/gs-marshal.c
+src/gs-marshal.h
+src/test-fade
+src/test-passwd
+src/test-watcher
+src/test-window
+src/xfce4-screensaver
+src/xfce4-screensaver-command
+src/xfce4-screensaver-dialog
+src/xfce4-screensaver-gl-helper
+src/xfce4-screensaver-preferences
+src/xfce4-screensaver.desktop
+src/xfce4-screensaver.desktop.in
+src/xfcekbd-indicator-marshal.h
+stamp-h1
diff --git a/configure.ac b/configure.ac
index 0ed571f..4981f60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,6 +48,7 @@ GLIB_REQUIRED_VERSION=2.50.0
GTK_REQUIRED_VERSION=3.22.0
X11_REQUIRED_VERSION=1.0
LIBXKLAVIER_REQUIRED=5.2
+XRANDR_REQUIRED=1.3
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(crypt.h sys/select.h)
@@ -56,6 +57,23 @@ AC_CHECK_FUNCS(sigaction syslog realpath setrlimit)
AC_CHECK_FUNCS(getresuid)
AC_TYPE_UID_T
+dnl Checks for X is RANDR extension
+
+AC_MSG_CHECKING(for xrandr)
+if $PKG_CONFIG --atleast-version $XRANDR_REQUIRED xrandr; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_RANDR, 1,
+ [Define if the xrandr-$XRANDR_REQUIRED library is present])
+ have_randr=yes
+ RANDR_PACKAGE=xrandr
+else
+ AC_MSG_RESULT(no)
+ have_randr=no
+ RANDR_PACKAGE=
+fi
+
+AC_SUBST(RANDR_PACKAGE)
+
AC_CHECK_FUNCS([setresuid setenv unsetenv clearenv])
PKG_CHECK_MODULES(MATE_SCREENSAVER,
x11 >= $X11_REQUIRED_VERSION
@@ -63,7 +81,8 @@ PKG_CHECK_MODULES(MATE_SCREENSAVER,
gtk+-3.0 >= $GTK_REQUIRED_VERSION
dbus-glib-1 >= $DBUS_REQUIRED_VERSION
gio-2.0 >= $GLIB_REQUIRED_VERSION
- libxklavier >= $LIBXKLAVIER_REQUIRED)
+ libxklavier >= $LIBXKLAVIER_REQUIRED
+ $RANDR_PACKAGE)
AC_SUBST(MATE_SCREENSAVER_CFLAGS)
AC_SUBST(MATE_SCREENSAVER_LIBS)
diff --git a/src/xfce-desktop-thumbnail.c b/src/xfce-desktop-thumbnail.c
index a214961..71e039a 100644
--- a/src/xfce-desktop-thumbnail.c
+++ b/src/xfce-desktop-thumbnail.c
@@ -254,218 +254,6 @@ get_thumbnailers_dirs (void)
}
static void
-size_prepared_cb (GdkPixbufLoader *loader,
- int width,
- int height,
- gpointer data)
-{
- SizePrepareContext *info = data;
-
- g_return_if_fail (width > 0 && height > 0);
-
- info->input_width = width;
- info->input_height = height;
-
- if (width < info->width && height < info->height) return;
-
- if (info->preserve_aspect_ratio &&
- (info->width > 0 || info->height > 0)) {
- if (info->width < 0)
- {
- width = width * (double)info->height/(double)height;
- height = info->height;
- }
- else if (info->height < 0)
- {
- height = height * (double)info->width/(double)width;
- width = info->width;
- }
- else if ((double)height * (double)info->width >
- (double)width * (double)info->height) {
- width = 0.5 + (double)width * (double)info->height / (double)height;
- height = info->height;
- } else {
- height = 0.5 + (double)height * (double)info->width / (double)width;
- width = info->width;
- }
- } else {
- if (info->width > 0)
- width = info->width;
- if (info->height > 0)
- height = info->height;
- }
-
- gdk_pixbuf_loader_set_size (loader, width, height);
-}
-
-static GdkPixbufLoader *
-create_loader (GFile *file,
- const guchar *data,
- gsize size)
-{
- GdkPixbufLoader *loader = NULL;
- GError *error = NULL;
- char *mime_type;
- char *filename;
-
- /* need to specify the type here because the gdk_pixbuf_loader_write
- doesn't have access to the filename in order to correct detect
- the image type. */
- filename = g_file_get_basename (file);
- mime_type = g_content_type_guess (filename, data, size, NULL);
- g_free (filename);
-
- if (mime_type != NULL) {
- loader = gdk_pixbuf_loader_new_with_mime_type (mime_type, &error);
- }
-
- if (loader == NULL && error != NULL) {
- g_warning ("Unable to create loader for mime type %s: %s", mime_type, error->message);
- g_clear_error (&error);
- loader = gdk_pixbuf_loader_new ();
- }
- g_free (mime_type);
-
- return loader;
-}
-
-static GdkPixbuf *
-_gdk_pixbuf_new_from_uri_at_scale (const char *uri,
- gint width,
- gint height,
- gboolean preserve_aspect_ratio)
-{
- gboolean result;
- guchar buffer[LOAD_BUFFER_SIZE];
- gsize bytes_read;
- GdkPixbufLoader *loader = NULL;
- GdkPixbuf *pixbuf;
- GdkPixbufAnimation *animation;
- GdkPixbufAnimationIter *iter;
- gboolean has_frame;
- SizePrepareContext info;
- GFile *file;
- GFileInfo *file_info;
- GInputStream *input_stream;
- GError *error = NULL;
-
- g_return_val_if_fail (uri != NULL, NULL);
-
- input_stream = NULL;
-
- file = g_file_new_for_uri (uri);
-
- /* First see if we can get an input stream via preview::icon */
- file_info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_PREVIEW_ICON,
- G_FILE_QUERY_INFO_NONE,
- NULL, /* GCancellable */
- NULL); /* return location for GError */
- if (file_info != NULL) {
- GObject *object;
-
- object = g_file_info_get_attribute_object (file_info,
- G_FILE_ATTRIBUTE_PREVIEW_ICON);
- if (object != NULL && G_IS_LOADABLE_ICON (object)) {
- input_stream = g_loadable_icon_load (G_LOADABLE_ICON (object),
- 0, /* size */
- NULL, /* return location for type */
- NULL, /* GCancellable */
- NULL); /* return location for GError */
- }
- g_object_unref (file_info);
- }
-
- if (input_stream == NULL) {
- input_stream = G_INPUT_STREAM (g_file_read (file, NULL, NULL));
- if (input_stream == NULL) {
- g_object_unref (file);
- return NULL;
- }
- }
-
- has_frame = FALSE;
-
- result = FALSE;
- while (!has_frame) {
-
- bytes_read = g_input_stream_read (input_stream,
- buffer,
- sizeof (buffer),
- NULL,
- &error);
- if (error != NULL) {
- g_warning ("Error reading from %s: %s", uri, error->message);
- g_clear_error (&error);
- }
- if (bytes_read == -1) {
- break;
- }
- result = TRUE;
- if (bytes_read == 0) {
- break;
- }
-
- if (loader == NULL) {
- loader = create_loader (file, buffer, bytes_read);
- if (1 <= width || 1 <= height) {
- info.width = width;
- info.height = height;
- info.input_width = info.input_height = 0;
- info.preserve_aspect_ratio = preserve_aspect_ratio;
- g_signal_connect (loader, "size-prepared", G_CALLBACK (size_prepared_cb), &info);
- }
- g_assert (loader != NULL);
- }
-
- if (!gdk_pixbuf_loader_write (loader,
- (unsigned char *)buffer,
- bytes_read,
- &error)) {
- g_warning ("Error creating thumbnail for %s: %s", uri, error->message);
- g_clear_error (&error);
- result = FALSE;
- break;
- }
-
- animation = gdk_pixbuf_loader_get_animation (loader);
- if (animation) {
- iter = gdk_pixbuf_animation_get_iter (animation, NULL);
- if (!gdk_pixbuf_animation_iter_on_currently_loading_frame (iter)) {
- has_frame = TRUE;
- }
- g_object_unref (iter);
- }
- }
-
- gdk_pixbuf_loader_close (loader, NULL);
-
- if (!result) {
- g_object_unref (G_OBJECT (loader));
- g_input_stream_close (input_stream, NULL, NULL);
- g_object_unref (input_stream);
- g_object_unref (file);
- return NULL;
- }
-
- g_input_stream_close (input_stream, NULL, NULL);
- g_object_unref (input_stream);
- g_object_unref (file);
-
- pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
- if (pixbuf != NULL) {
- g_object_ref (G_OBJECT (pixbuf));
- g_object_set_data (G_OBJECT (pixbuf), "mate-original-width",
- GINT_TO_POINTER (info.input_width));
- g_object_set_data (G_OBJECT (pixbuf), "mate-original-height",
- GINT_TO_POINTER (info.input_height));
- }
- g_object_unref (G_OBJECT (loader));
-
- return pixbuf;
-}
-
-static void
xfce_desktop_thumbnail_factory_finalize (GObject *object)
{
XfceDesktopThumbnailFactory *factory;
@@ -1089,75 +877,6 @@ xfce_desktop_thumbnail_factory_can_thumbnail (XfceDesktopThumbnailFactory *facto
return FALSE;
}
-static char *
-expand_thumbnailing_script (const char *script,
- const int size,
- const char *inuri,
- const char *outfile)
-{
- GString *str;
- const char *p, *last;
- char *localfile, *quoted;
- gboolean got_in;
-
- str = g_string_new (NULL);
-
- got_in = FALSE;
- last = script;
- while ((p = strchr (last, '%')) != NULL)
- {
- g_string_append_len (str, last, p - last);
- p++;
-
- switch (*p) {
- case 'u':
- quoted = g_shell_quote (inuri);
- g_string_append (str, quoted);
- g_free (quoted);
- got_in = TRUE;
- p++;
- break;
- case 'i':
- localfile = g_filename_from_uri (inuri, NULL, NULL);
- if (localfile)
- {
- quoted = g_shell_quote (localfile);
- g_string_append (str, quoted);
- got_in = TRUE;
- g_free (quoted);
- g_free (localfile);
- }
- p++;
- break;
- case 'o':
- quoted = g_shell_quote (outfile);
- g_string_append (str, quoted);
- g_free (quoted);
- p++;
- break;
- case 's':
- g_string_append_printf (str, "%d", size);
- p++;
- break;
- case '%':
- g_string_append_c (str, '%');
- p++;
- break;
- case 0:
- default:
- break;
- }
- last = p;
- }
- g_string_append (str, last);
-
- if (got_in)
- return g_string_free (str, FALSE);
-
- g_string_free (str, TRUE);
- return NULL;
-}
-
static gboolean
make_thumbnail_dirs (XfceDesktopThumbnailFactory *factory)
{
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list