summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/eom-application.c17
-rw-r--r--src/eom-image-private.h2
-rw-r--r--src/eom-image.c20
-rw-r--r--src/eom-metadata-reader-jpg.c9
-rw-r--r--src/eom-metadata-reader-png.c25
-rw-r--r--src/eom-metadata-reader.c2
-rw-r--r--src/eom-window.c14
-rw-r--r--src/main.c2
8 files changed, 50 insertions, 41 deletions
diff --git a/src/eom-application.c b/src/eom-application.c
index a46ead7..20d9aca 100644
--- a/src/eom-application.c
+++ b/src/eom-application.c
@@ -332,24 +332,11 @@ eom_application_get_file_window (EomApplication *application, GFile *file)
static void
eom_application_show_window (EomWindow *window, gpointer user_data)
{
- guint32 timestamp = GPOINTER_TO_UINT (user_data);
-
- /* set the proper interaction time on the window.
- * Fall back to roundtripping to the X server when we
- * don't have the timestamp, e.g. when launched from
- * terminal. We also need to make sure that the window
- * has been realized otherwise it will not work. lame.
- */
if (!gtk_widget_get_realized (GTK_WIDGET (window)))
gtk_widget_realize (GTK_WIDGET (window));
- if (timestamp <= 0)
- timestamp = gdk_x11_get_server_time (gtk_widget_get_window (GTK_WIDGET (window)));
-
- gdk_x11_window_set_user_time (gtk_widget_get_window (GTK_WIDGET (window)),
- timestamp);
-
- gtk_window_present (GTK_WINDOW (window));
+ gtk_window_present_with_time (GTK_WINDOW (window),
+ GPOINTER_TO_UINT (user_data));
}
/**
diff --git a/src/eom-image-private.h b/src/eom-image-private.h
index fbe46ae..baa401e 100644
--- a/src/eom-image-private.h
+++ b/src/eom-image-private.h
@@ -73,7 +73,7 @@ struct _EomImagePrivate {
XmpPtr xmp;
#endif
-#ifdef HAVE_LCMS
+#if defined(HAVE_LCMS) && defined(GDK_WINDOWING_X11)
cmsHPROFILE profile;
#endif
diff --git a/src/eom-image.c b/src/eom-image.c
index f8add9d..01a869a 100644
--- a/src/eom-image.c
+++ b/src/eom-image.c
@@ -24,6 +24,7 @@
#endif
#define GDK_PIXBUF_ENABLE_BACKEND
+#include <gdk/gdkx.h>
#include "eom-image.h"
#include "eom-image-private.h"
@@ -58,7 +59,7 @@
#include <libexif/exif-loader.h>
#endif
-#ifdef HAVE_LCMS
+#if defined(HAVE_LCMS) && defined(GDK_WINDOWING_X11)
#include <lcms2.h>
#ifndef EXIF_TAG_GAMMA
#define EXIF_TAG_GAMMA 0xa500
@@ -142,9 +143,11 @@ eom_image_free_mem_private (EomImage *image)
}
#endif
-#ifdef HAVE_LCMS
+#if defined(HAVE_LCMS) && defined(GDK_WINDOWING_X11)
if (priv->profile != NULL) {
- cmsCloseProfile (priv->profile);
+ if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
+ cmsCloseProfile (priv->profile);
+ }
priv->profile = NULL;
}
#endif
@@ -306,7 +309,7 @@ eom_image_init (EomImage *img)
#ifdef HAVE_EXEMPI
img->priv->xmp = NULL;
#endif
-#ifdef HAVE_LCMS
+#if defined(HAVE_LCMS) && defined(GDK_WINDOWING_X11)
img->priv->profile = NULL;
#endif
#ifdef HAVE_RSVG
@@ -616,7 +619,7 @@ eom_image_get_file_info (EomImage *img,
}
}
-#ifdef HAVE_LCMS
+#if defined(HAVE_LCMS) && defined(GDK_WINDOWING_X11)
void
eom_image_apply_display_profile (EomImage *img, cmsHPROFILE screen)
{
@@ -630,6 +633,9 @@ eom_image_apply_display_profile (EomImage *img, cmsHPROFILE screen)
priv = img->priv;
if (screen == NULL) return;
+ if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
+ return;
+ }
if (priv->profile == NULL) {
/* Check whether GdkPixbuf was able to extract a profile */
@@ -1062,7 +1068,7 @@ eom_image_real_load (EomImage *img,
if (set_metadata) {
eom_image_set_exif_data (img, md_reader);
-#ifdef HAVE_LCMS
+#if defined(HAVE_LCMS) && defined(GDK_WINDOWING_X11)
eom_image_set_icc_data (img, md_reader);
#endif
@@ -1348,7 +1354,7 @@ eom_image_get_pixbuf (EomImage *img)
return image;
}
-#ifdef HAVE_LCMS
+#if defined(HAVE_LCMS) && defined(GDK_WINDOWING_X11)
cmsHPROFILE
eom_image_get_profile (EomImage *img)
{
diff --git a/src/eom-metadata-reader-jpg.c b/src/eom-metadata-reader-jpg.c
index f965861..b49135a 100644
--- a/src/eom-metadata-reader-jpg.c
+++ b/src/eom-metadata-reader-jpg.c
@@ -26,6 +26,7 @@
#endif
#include <string.h>
+#include <gdk/gdkx.h>
#include "eom-metadata-reader.h"
#include "eom-metadata-reader-jpg.h"
@@ -497,7 +498,7 @@ eom_metadata_reader_jpg_get_xmp_data (EomMetadataReaderJpg *emr )
* parse the sections and construct a single memory chunk, or maybe even parse
* the profile.
*/
-#ifdef HAVE_LCMS
+#if defined(HAVE_LCMS) && defined(GDK_WINDOWING_X11)
static gpointer
eom_metadata_reader_jpg_get_icc_profile (EomMetadataReaderJpg *emr)
{
@@ -509,7 +510,9 @@ eom_metadata_reader_jpg_get_icc_profile (EomMetadataReaderJpg *emr)
priv = emr->priv;
if (priv->icc_chunk) {
- profile = cmsOpenProfileFromMem(priv->icc_chunk + 14, priv->icc_len - 14);
+ if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
+ profile = cmsOpenProfileFromMem(priv->icc_chunk + 14, priv->icc_len - 14);
+ }
if (profile) {
eom_debug_message (DEBUG_LCMS, "JPEG has ICC profile");
@@ -653,7 +656,7 @@ eom_metadata_reader_jpg_init_emr_iface (gpointer g_iface, gpointer iface_data)
(gpointer (*) (EomMetadataReader *self))
eom_metadata_reader_jpg_get_exif_data;
#endif
-#ifdef HAVE_LCMS
+#if defined(HAVE_LCMS) && defined(GDK_WINDOWING_X11)
iface->get_icc_profile =
(gpointer (*) (EomMetadataReader *self))
eom_metadata_reader_jpg_get_icc_profile;
diff --git a/src/eom-metadata-reader-png.c b/src/eom-metadata-reader-png.c
index eadf036..a0ca172 100644
--- a/src/eom-metadata-reader-png.c
+++ b/src/eom-metadata-reader-png.c
@@ -28,6 +28,7 @@
#include <math.h>
#include <string.h>
#include <zlib.h>
+#include <gdk/gdkx.h>
#include "eom-metadata-reader.h"
#include "eom-metadata-reader-png.h"
@@ -477,7 +478,7 @@ eom_metadata_reader_png_get_xmp_data (EomMetadataReaderPng *emr )
}
#endif
-#ifdef HAVE_LCMS
+#if defined(HAVE_LCMS) && defined(GDK_WINDOWING_X11)
#define EXTRACT_DOUBLE_UINT_BLOCK_OFFSET(chunk,offset,divider) \
(double)(GUINT32_FROM_BE(*((guint32*)((chunk)+((offset)*4))))/(double)(divider))
@@ -585,7 +586,9 @@ eom_metadata_reader_png_get_icc_profile (EomMetadataReaderPng *emr)
return NULL;
}
- profile = cmsOpenProfileFromMem(outbuf, zstr.total_out);
+ if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
+ profile = cmsOpenProfileFromMem(outbuf, zstr.total_out);
+ }
inflateEnd (&zstr);
g_free (outbuf);
@@ -597,7 +600,9 @@ eom_metadata_reader_png_get_icc_profile (EomMetadataReaderPng *emr)
/* If the file has an sRGB chunk the image data is in the sRGB
* colorspace. lcms has a built-in sRGB profile. */
- profile = cmsCreate_sRGBProfile ();
+ if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
+ profile = cmsCreate_sRGBProfile ();
+ }
}
if (!profile && priv->cHRM_chunk && priv->gAMA_chunk) {
@@ -632,13 +637,17 @@ eom_metadata_reader_png_get_icc_profile (EomMetadataReaderPng *emr)
* profile instead of computing one that "gets close". */
if(_chrm_matches_srgb (&whitepoint, &primaries, gammaValue)) {
eom_debug_message (DEBUG_LCMS, "gAMA and cHRM match sRGB");
- profile = cmsCreate_sRGBProfile ();
+ if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
+ profile = cmsCreate_sRGBProfile ();
+ }
} else {
gamma[0] = gamma[1] = gamma[2] =
cmsBuildGamma (NULL, gammaValue);
- profile = cmsCreateRGBProfile (&whitepoint, &primaries,
- gamma);
- cmsFreeToneCurve(gamma[0]);
+ if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
+ profile = cmsCreateRGBProfile (&whitepoint, &primaries,
+ gamma);
+ cmsFreeToneCurve(gamma[0]);
+ }
}
}
@@ -659,7 +668,7 @@ eom_metadata_reader_png_init_emr_iface (gpointer g_iface, gpointer iface_data)
iface->finished =
(gboolean (*) (EomMetadataReader *self))
eom_metadata_reader_png_finished;
-#ifdef HAVE_LCMS
+#if defined(HAVE_LCMS) && defined(GDK_WINDOWING_X11)
iface->get_icc_profile =
(cmsHPROFILE (*) (EomMetadataReader *self))
eom_metadata_reader_png_get_icc_profile;
diff --git a/src/eom-metadata-reader.c b/src/eom-metadata-reader.c
index 187cb06..cd796f0 100644
--- a/src/eom-metadata-reader.c
+++ b/src/eom-metadata-reader.c
@@ -92,7 +92,7 @@ eom_metadata_reader_get_xmp_data (EomMetadataReader *emr)
}
#endif
-#ifdef HAVE_LCMS
+#if defined(HAVE_LCMS) && defined(GDK_WINDOWING_X11)
cmsHPROFILE
eom_metadata_reader_get_icc_profile (EomMetadataReader *emr)
{
diff --git a/src/eom-window.c b/src/eom-window.c
index fad39b3..a3937d6 100644
--- a/src/eom-window.c
+++ b/src/eom-window.c
@@ -189,7 +189,7 @@ struct _EomWindowPrivate {
PeasExtensionSet *extensions;
-#ifdef HAVE_LCMS
+#if defined(HAVE_LCMS) && defined(GDK_WINDOWING_X11)
cmsHPROFILE *display_profile;
#endif
};
@@ -378,7 +378,7 @@ eom_window_can_save_changed_cb (GSettings *settings, gchar *key, gpointer user_d
G_GNUC_END_IGNORE_DEPRECATIONS;
}
-#ifdef HAVE_LCMS
+#if defined(HAVE_LCMS) && defined(GDK_WINDOWING_X11)
static cmsHPROFILE *
eom_window_get_display_profile (GdkScreen *screen)
{
@@ -393,6 +393,10 @@ eom_window_get_display_profile (GdkScreen *screen)
cmsHPROFILE *profile = NULL;
char *atom_name;
+ if (!GDK_IS_X11_SCREEN (screen)) {
+ return NULL;
+ }
+
dpy = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
if (gdk_x11_screen_get_screen_number (screen) > 0)
@@ -1316,7 +1320,7 @@ eom_job_load_cb (EomJobLoad *job, gpointer data)
priv->image = g_object_ref (job->image);
if (EOM_JOB (job)->error == NULL) {
-#ifdef HAVE_LCMS
+#if defined(HAVE_LCMS) && defined(GDK_WINDOWING_X11)
eom_image_apply_display_profile (job->image,
priv->display_profile);
#endif
@@ -4740,7 +4744,7 @@ eom_window_init (EomWindow *window)
window->priv->mode = EOM_WINDOW_MODE_UNKNOWN;
window->priv->status = EOM_WINDOW_STATUS_UNKNOWN;
-#ifdef HAVE_LCMS
+#if defined(HAVE_LCMS) && defined(GDK_WINDOWING_X11)
window->priv->display_profile =
eom_window_get_display_profile (screen);
#endif
@@ -4884,7 +4888,7 @@ eom_window_dispose (GObject *object)
priv->file_list = NULL;
}
-#ifdef HAVE_LCMS
+#if defined(HAVE_LCMS) && defined(GDK_WINDOWING_X11)
if (priv->display_profile != NULL) {
cmsCloseProfile (priv->display_profile);
priv->display_profile = NULL;
diff --git a/src/main.c b/src/main.c
index f765f5c..dbe7713 100644
--- a/src/main.c
+++ b/src/main.c
@@ -103,7 +103,7 @@ main (int argc, char **argv)
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
- gdk_set_allowed_backends ("x11");
+ gdk_set_allowed_backends ("wayland,x11");
ctx = g_option_context_new (_("[FILEā€¦]"));
g_option_context_add_main_entries (ctx, goption_options, PACKAGE);