1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00
putty-source/unix/utils/get_x11_display.c
Simon Tatham d9f217323e Break up gtkmisc.c.
It's another file that should have been subdivided into lots of tiny
separate things in the utils library - especially since for some
reason I made a completely separate 'guimisc' cmake-level library for
it when there was no need.
2021-04-26 18:00:01 +01:00

35 lines
767 B
C

/*
* Return the Xlib 'Display *' underlying our GTK environment, if any.
*/
#include <gtk/gtk.h>
#include "putty.h"
#include "gtkcompat.h"
#include "gtkmisc.h"
#ifndef NOT_X_WINDOWS
#include <gdk/gdkx.h>
#include <X11/Xlib.h>
Display *get_x11_display(void)
{
#if GTK_CHECK_VERSION(3,0,0)
if (!GDK_IS_X11_DISPLAY(gdk_display_get_default()))
return NULL;
#endif
return GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
}
#else
/*
* Include _something_ in this file to prevent an annoying compiler
* warning, and to avoid having to condition out this file in
* CMakeLists. It's in a library, so this variable shouldn't end up in
* any actual program, because nothing will refer to it.
*/
const int get_x11_display_dummy_variable = 0;
#endif