Make gdk-x11 optional

This commit is contained in:
Marvin W 2017-04-15 22:02:05 +02:00
parent a0b2a66ef0
commit 653c361420
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
3 changed files with 26 additions and 1 deletions

View File

@ -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

View File

@ -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}\")

View File

@ -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()) {