aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/FindGDK3.cmake11
-rw-r--r--main/CMakeLists.txt12
-rw-r--r--main/src/ui/notifications.vala4
3 files changed, 26 insertions, 1 deletions
diff --git a/cmake/FindGDK3.cmake b/cmake/FindGDK3.cmake
index fd5061c0..fe8e13e5 100644
--- a/cmake/FindGDK3.cmake
+++ b/cmake/FindGDK3.cmake
@@ -24,6 +24,17 @@ if(GDK3_FOUND AND NOT GDK3_VERSION)
endif()
endif()
+if(GDK3_FOUND)
+ find_path(GDK3_INCLUDE_DIR "gdk/gdk.h" HINTS ${GDK3_INCLUDE_DIRS})
+ unset(GDK3_WITH_X11)
+
+ if(GDK3_INCLUDE_DIR)
+ if(EXISTS "${GDK3_INCLUDE_DIR}/gdk/gdkx.h")
+ set(GDK3_WITH_X11 yes)
+ endif()
+ endif()
+endif()
+
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GDK3
FOUND_VAR GDK3_FOUND
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()) {