From 653c361420d658097a4affeb8bf256f02cc9bb2a Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sat, 15 Apr 2017 22:02:05 +0200 Subject: Make gdk-x11 optional --- main/CMakeLists.txt | 12 +++++++++++- main/src/ui/notifications.vala | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'main') diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 010ff221..8baa393b 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -57,6 +57,14 @@ compile_gresources( SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data ) +unset(MAIN_EXTRA_OPTIONS) +unset(MAIN_EXTRA_PACKAGES) +find_package(GDK3) +if(GDK3_WITH_X11) + set(MAIN_EXTRA_OPTIONS ${MAIN_EXTRA_OPTIONS} -D GDK3_WITH_X11) + set(MAIN_EXTRA_PACKAGES ${MAIN_EXTRA_PACKAGES} gdk-x11-3.0) +endif(GDK3_WITH_X11) + vala_precompile(MAIN_VALA_C SOURCES src/main.vala @@ -107,9 +115,11 @@ CUSTOM_VAPIS ${CMAKE_BINARY_DIR}/exports/dino_internal.vapi PACKAGES ${MAIN_PACKAGES} - gdk-x11-3.0 + ${MAIN_EXTRA_PACKAGES} GRESOURCES ${MAIN_GRESOURCES_XML} +OPTIONS + ${MAIN_EXTRA_OPTIONS} ) add_definitions(${VALA_CFLAGS} -DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" -DLOCALE_INSTALL_DIR=\"${LOCALE_INSTALL_DIR}\") diff --git a/main/src/ui/notifications.vala b/main/src/ui/notifications.vala index af2c80fe..e5eda271 100644 --- a/main/src/ui/notifications.vala +++ b/main/src/ui/notifications.vala @@ -36,12 +36,16 @@ public class Notifications : Object { notifications[conversation].set_hint("transient", true); notifications[conversation].add_action("default", "Open", () => { conversation_selected(conversation); +#if GDK3_WITH_X11 Gdk.X11.Window x11window = window.get_window() as Gdk.X11.Window; if (x11window != null) { window.present_with_time(Gdk.X11.get_server_time(x11window)); } else { window.present(); } +#else + window.present(); +#endif }); } if (!stream_interactor.get_module(ChatInteraction.IDENTITY).is_active_focus()) { -- cgit v1.2.3-70-g09d2