Changes to support building open-vm-tools with gtk3.
#ifdef statements have been added for conditional compiling for GTK2/GTK3.
[enable_multimon="$enableval"],
[enable_multimon="yes"])
+AC_ARG_WITH(
+ gtk3,
+ AS_HELP_STRING(
+ [--without-gtk3],
+ [compiles without Gtk 3.0]),
+ [with_gtk3="$withval"],
+ [with_gtk3="no"])
+
AC_ARG_WITH(
gtk2,
AS_HELP_STRING(
[--without-gtk2],
[compiles without Gtk 2.0]),
[with_gtk2="$withval"],
- [with_gtk2="yes"])
-
-AC_ARG_WITH(
- gtkmm,
- AS_HELP_STRING(
- [--without-gtkmm],
- [compiles without Gtkmm, sigc++, and related libs]),
- [with_gtkmm="$withval"],
- [with_gtkmm="yes"])
+ [if test "$with_gtk3" = "yes"; then with_gtk2="no" ; else with_gtk2="yes"; fi])
+
+if test "$with_gtk3" = "yes"; then
+ AC_ARG_WITH(
+ gtkmm3,
+ AS_HELP_STRING(
+ [--without-gtkmm3],
+ [compiles without Gtkmm 3, sigc++, and related libs]),
+ [with_gtkmm3="$withval"],
+ [with_gtkmm3="yes"])
+ with_gtkmm="no"
+else
+ AC_ARG_WITH(
+ gtkmm,
+ AS_HELP_STRING(
+ [--without-gtkmm],
+ [compiles without Gtkmm, sigc++, and related libs]),
+ [with_gtkmm="$withval"],
+ [with_gtkmm="yes"])
+ with_gtkmm3="no"
+fi
AC_ARG_ENABLE(
docs,
have_xcomposite="yes"
fi
- # Check whether we have gtk+ 2.0.
- if test "$with_gtk2" != "no"; then
+ # Check whether we have gtk+ 3.0.
+ if test "$with_gtk3" != "no"; then
# gdk_display_get_default_group (added in gtk+ 2.4.0) is function currently
# needed by vmware-user.
+ AC_VMW_CHECK_LIB([gtk-3],
+ [GTK],
+ [gtk+-3.0],
+ [],
+ [3.0.0],
+ [gtk/gtk.h],
+ [gdk_display_get_default_group],
+ [GTK_CPPFLAGS="$GTK_CPPFLAGS -DGTK3"],
+ [AC_MSG_ERROR([Gtk+ 3.0 library not found or too old. Please configure without Gtk+ support (using --without-gtk3) or install the Gtk+ 3.0 devel package.])])
+
+ # Check whether we have gtk+ 2.0.
+ elif test "$with_gtk2" != "no"; then
AC_VMW_CHECK_LIB([gtk-x11-2.0],
[GTK],
[gtk+-2.0],
# Check for gtkmm 2.4.0 or greater.
#
- if test "$with_gtkmm" != "no"; then
- CUSTOM_GTKMM_CPPFLAGS="$CUSTOM_GTKMM_CPPFLAGS $GTK_CPPFLAGS"
- AC_VMW_CHECK_LIBXX([gtkmm-2.4],
- [GTKMM],
- [gtkmm-2.4],
- [],
- [2.4.0],
- [gtkmm.h],
- [],
- [GTKMM_CPPFLAGS="$GTKMM_CPPFLAGS -DHAVE_GTKMM"],
- [AC_MSG_ERROR([gtkmm library not found. Please install the libgtkmm devel package(s), or re-configure using --without-gtkmm.])])
+
+ if test "$with_gtkmm" != "no" -o "$with_gtkmm3" != "no"; then
+ if test "$with_gtkmm3" != "no"; then
+ AC_VMW_CHECK_LIBXX([gtkmm-3.0],
+ [GTKMM],
+ [gtkmm-3.0],
+ [],
+ [3.0.0],
+ [],
+ [],
+ [GTKMM_CPPFLAGS="$GTKMM_CPPFLAGS -DHAVE_GTKMM"],
+ [AC_MSG_ERROR([gtkmm3 library not found. Please install the libgtkmm devel package(s), or re-configure using --without-gtkmm3.])])
+
+ elif test "$with_gtkmm" != "no"; then
+ CUSTOM_GTKMM_CPPFLAGS="$CUSTOM_GTKMM_CPPFLAGS $GTK_CPPFLAGS"
+ AC_VMW_CHECK_LIBXX([gtkmm-2.4],
+ [GTKMM],
+ [gtkmm-2.4],
+ [],
+ [2.4.0],
+ [gtkmm.h],
+ [],
+ [GTKMM_CPPFLAGS="$GTKMM_CPPFLAGS -DHAVE_GTKMM"],
+ [AC_MSG_ERROR([gtkmm library not found. Please install the libgtkmm devel package(s), or re-configure using --without-gtkmm.])])
+ fi
#
# libsigc++-2.0 >= 2.5.1 requires C++11 support
AM_CONDITIONAL(HAVE_DOXYGEN, test "$have_doxygen" = "yes")
AM_CONDITIONAL(HAVE_FUSE, test "$have_fuse" = "yes")
AM_CONDITIONAL(HAVE_GNU_LD, test "$with_gnu_ld" = "yes")
-AM_CONDITIONAL(HAVE_GTKMM, test "$have_x" = "yes" -a "$with_gtkmm" = "yes")
+AM_CONDITIONAL(HAVE_GTKMM, test "$have_x" = "yes" -a \( "$with_gtkmm" = "yes" -o "$with_gtkmm3" = "yes" \) )
AM_CONDITIONAL(HAVE_PAM, test "$with_pam" = "yes")
AM_CONDITIONAL(USE_SLASH_PROC, test "$os" = "linux")
AM_CONDITIONAL(USE_PRINTF_WRAPPERS, test "$bsdPrintfWrappers" = "yes")
#include "debug.h"
#ifndef GTK2
-#error "Gtk 2.0 is required"
+#ifndef GTK3
+#error "Gtk 2.0 or 3.0 is required"
+#endif
#endif
#include <libgen.h>
gdkDisplay = gdk_display_get_default();
gdkLeader = gdk_display_get_default_group(gdkDisplay);
- myGroupLeader = GDK_WINDOW_XWINDOW(gdkLeader);
+ myGroupLeader = GDK_WINDOW_XID(gdkLeader);
myRootWindow = GDK_ROOT_WINDOW();
ASSERT(myGroupLeader);
ASSERT(myRootWindow);
/* XXX: With g_set_prgname() being called, this can probably go away. */
- XStoreName(GDK_DISPLAY(), myGroupLeader, VMUSER_TITLE);
+ XStoreName(gdk_x11_get_default_xdisplay(), myGroupLeader, VMUSER_TITLE);
/*
* Sanity check: Set the override redirect property on our group leader
* This makes sure that (a) a window manager can't re-parent our window,
* and (b) that we remain a top-level window.
*/
- XChangeWindowAttributes(GDK_DISPLAY(), myGroupLeader, CWOverrideRedirect,
+ XChangeWindowAttributes(gdk_x11_get_default_xdisplay(), myGroupLeader, CWOverrideRedirect,
&attr);
- XReparentWindow(GDK_DISPLAY(), myGroupLeader, myRootWindow, 10, 10);
- XSync(GDK_DISPLAY(), FALSE);
+ XReparentWindow(gdk_x11_get_default_xdisplay(), myGroupLeader, myRootWindow, 10, 10);
+ XSync(gdk_x11_get_default_xdisplay(), FALSE);
*groupLeader = myGroupLeader;
*rootWindow = myRootWindow;
Bool alreadyLocked = FALSE; // Set to TRUE if we discover lock is held.
Bool retval = FALSE;
- defaultDisplay = GDK_DISPLAY();
+ defaultDisplay = gdk_x11_get_default_xdisplay();
/*
* Reset some of our main window's settings & fetch Xlib handles for
GList *selectionLists;
/* Get selection list. */
+#ifndef GTK3
selectionLists = gtk_object_get_data(GTK_OBJECT (widget), selection_handler_key);
+#else
+ selectionLists = g_object_get_data(G_OBJECT (widget), selection_handler_key);
+#endif
tempList = selectionLists;
while (tempList) {
/* Enumerate the list to find the selection. */
/* Remove target. */
gtk_target_list_remove(targetList->list, target);
/* If no more target, remove selection from list. */
+#ifndef GTK3
+ /* the following code does not build with gtk3 - it may not be
+ necessary and gtk_target_list_remove() takes care of it,
+ or we create a memory leak. */
if (!targetList->list->list) {
/* Free target list. */
gtk_target_list_unref(targetList->list);
selectionLists = g_list_remove_link(selectionLists, tempList);
g_list_free_1(tempList);
}
+#endif
break;
}
tempList = tempList->next;
}
/* Put new selection list back. */
+#ifndef GTK3
gtk_object_set_data (GTK_OBJECT (widget), selection_handler_key, selectionLists);
+#else
+ g_object_set_data (G_OBJECT (widget), selection_handler_key, selectionLists);
+#endif
}
gpointer data) // IN: unused
{
char *target;
+#ifndef GTK3
char *utf8Str = NULL;
+#else
+ const char *utf8Str = NULL;
+ char *utf8Str_cvt = NULL;
+#endif
size_t len;
size_t aligned_len;
goto exit;
}
+#ifndef GTK3
if (selection_data->length < 0) {
+#else
+ if (gtk_selection_data_get_length(selection_data) < 0) {
+#endif
g_debug("CopyPasteSelectionReceivedCB: Error, length less than 0\n");
goto exit;
}
/* Try to get clipboard or selection timestamp. */
+#ifndef GTK3
if (selection_data->target == GDK_SELECTION_TYPE_TIMESTAMP) {
if (selection_data->selection == GDK_SELECTION_PRIMARY) {
if (selection_data->length == 4) {
gGuestSelPrimaryTime = *(uint32 *)selection_data->data;
+#else
+ if (gtk_selection_data_get_target(selection_data) == GDK_SELECTION_TYPE_TIMESTAMP) {
+ if (gtk_selection_data_get_selection(selection_data) == GDK_SELECTION_PRIMARY) {
+ if (gtk_selection_data_get_length(selection_data) == 4) {
+ gGuestSelPrimaryTime = *(uint32 *)gtk_selection_data_get_data(selection_data);
+#endif
g_debug("CopyPasteSelectionReceivedCB: Got pri time [%"FMT64"u]\n",
gGuestSelPrimaryTime);
+#ifndef GTK3
} else if (selection_data->length == 8) {
gGuestSelPrimaryTime = *(uint64 *)selection_data->data;
+#else
+ } else if (gtk_selection_data_get_length(selection_data) == 8) {
+ gGuestSelPrimaryTime = *(uint64 *)gtk_selection_data_get_data(selection_data);
+#endif
g_debug("CopyPasteSelectionReceivedCB: Got pri time [%"FMT64"u]\n",
gGuestSelPrimaryTime);
} else {
g_debug("CopyPasteSelectionReceivedCB: Unknown pri time. Size %d\n",
+#ifndef GTK3
selection_data->length);
+#else
+ gtk_selection_data_get_length(selection_data));
+#endif
}
}
+#ifndef GTK3
if (selection_data->selection == GDK_SELECTION_CLIPBOARD) {
if (selection_data->length == 4) {
gGuestSelClipboardTime = *(uint32 *)selection_data->data;
+#else
+ if (gtk_selection_data_get_selection(selection_data) == GDK_SELECTION_CLIPBOARD) {
+ if (gtk_selection_data_get_length(selection_data) == 4) {
+ gGuestSelClipboardTime = *(uint32 *)gtk_selection_data_get_data(selection_data);
+#endif
g_debug("CopyPasteSelectionReceivedCB: Got clip time [%"FMT64"u]\n",
gGuestSelClipboardTime);
+#ifndef GTK3
} else if (selection_data->length == 8) {
gGuestSelClipboardTime = *(uint64 *)selection_data->data;
+#else
+ } else if (gtk_selection_data_get_length(selection_data) == 8) {
+ gGuestSelClipboardTime = *(uint64 *)gtk_selection_data_get_data(selection_data);
+#endif
g_debug("CopyPasteSelectionReceivedCB: Got clip time [%"FMT64"u]\n",
gGuestSelClipboardTime);
} else {
g_debug("CopyPasteSelectionReceivedCB: Unknown clip time. Size %d\n",
+#ifndef GTK3
selection_data->length);
+#else
+ gtk_selection_data_get_length(selection_data));
+#endif
}
}
goto exit;
}
+#ifndef GTK3
if (selection_data->selection == GDK_SELECTION_PRIMARY) {
+#else
+ if (gtk_selection_data_get_selection(selection_data) == GDK_SELECTION_PRIMARY) {
+#endif
target = gGuestSelPrimaryBuf;
+#ifndef GTK3
} else if (selection_data->selection == GDK_SELECTION_CLIPBOARD) {
+#else
+ } else if (gtk_selection_data_get_selection(selection_data) == GDK_SELECTION_CLIPBOARD) {
+#endif
target = gGuestSelClipboardBuf;
} else {
goto exit;
}
+#ifndef GTK3
utf8Str = selection_data->data;
len = strlen(selection_data->data);
}
goto exit;
}
+#else
+ utf8Str = gtk_selection_data_get_data(selection_data);
+ len = strlen(gtk_selection_data_get_data(selection_data));
+
+ if (gtk_selection_data_get_target(selection_data) != GDK_SELECTION_TYPE_STRING &&
+ gtk_selection_data_get_target(selection_data) != GDK_SELECTION_TYPE_UTF8_STRING) {
+ /* It is a file list. */
+ if (len >= MAX_SELECTION_BUFFER_LENGTH - 1) {
+ Warning("CopyPasteSelectionReceivedCB file list too long\n");
+ } else {
+ memcpy(target, gtk_selection_data_get_data(selection_data), len + 1);
+ }
+ goto exit;
+ }
+#endif
/*
* If target is GDK_SELECTION_TYPE_STRING, assume encoding is local code
* set. Convert to utf8 before send to vmx.
*/
+#ifndef GTK3
if (selection_data->target == GDK_SELECTION_TYPE_STRING &&
!CodeSet_CurrentToUtf8(selection_data->data,
selection_data->length,
gWaitingOnGuestSelection = FALSE;
return;
}
+#else
+ if (gtk_selection_data_get_target(selection_data) == GDK_SELECTION_TYPE_STRING) {
+ if (!CodeSet_CurrentToUtf8(gtk_selection_data_get_data(selection_data),
+ gtk_selection_data_get_length(selection_data),
+ &utf8Str_cvt,
+ &len)) {
+ g_debug("CopyPasteSelectionReceivedCB: Couldn't convert to utf8 code set\n");
+ gWaitingOnGuestSelection = FALSE;
+ return;
+ } else {
+ utf8Str = utf8Str_cvt;
+ }
+ }
+#endif
/*
* String in backdoor communication is 4 bytes by 4 bytes, so the len
}
exit:
+#ifndef GTK3
if (selection_data->target == GDK_SELECTION_TYPE_STRING) {
free(utf8Str);
+#else
+ if (gtk_selection_data_get_target(selection_data) == GDK_SELECTION_TYPE_STRING) {
+ free(utf8Str_cvt);
+#endif
}
gWaitingOnGuestSelection = FALSE;
}
}
/* If it is text copy paste, return gHostClipboardBuf. */
+#ifndef GTK3
if (GDK_SELECTION_TYPE_STRING == selection_data->target ||
GDK_SELECTION_TYPE_UTF8_STRING == selection_data->target) {
+#else
+ if (GDK_SELECTION_TYPE_STRING == gtk_selection_data_get_target(selection_data) ||
+ GDK_SELECTION_TYPE_UTF8_STRING == gtk_selection_data_get_target(selection_data)) {
+#endif
char *outBuf = gHostClipboardBuf;
size_t len = strlen(gHostClipboardBuf);
* If target is GDK_SELECTION_TYPE_STRING, assume encoding is local code
* set. Convert from utf8 to local one.
*/
+#ifndef GTK3
if (GDK_SELECTION_TYPE_STRING == selection_data->target &&
+#else
+ if (GDK_SELECTION_TYPE_STRING == gtk_selection_data_get_target(selection_data) &&
+#endif
!CodeSet_Utf8ToCurrent(gHostClipboardBuf,
strlen(gHostClipboardBuf),
&outBuf,
return;
}
+#ifndef GTK3
gtk_selection_data_set(selection_data, selection_data->target, 8,
+#else
+ gtk_selection_data_set(selection_data, gtk_selection_data_get_target(selection_data), 8,
+#endif
outBuf, len);
g_debug("CopyPasteSelectionGetCB: Set text [%s]\n", outBuf);
+#ifndef GTK3
if (GDK_SELECTION_TYPE_STRING == selection_data->target) {
+#else
+ if (GDK_SELECTION_TYPE_STRING == gtk_selection_data_get_target(selection_data)) {
+#endif
free(outBuf);
}
gtk_selection_add_target(mainWnd, GDK_SELECTION_CLIPBOARD,
GDK_SELECTION_TYPE_UTF8_STRING, 0);
+#ifndef GTK3
gtk_signal_connect(GTK_OBJECT(mainWnd), "selection_received",
GTK_SIGNAL_FUNC(CopyPasteSelectionReceivedCB), mainWnd);
gtk_signal_connect(GTK_OBJECT(mainWnd), "selection_get",
GTK_SIGNAL_FUNC(CopyPasteSelectionGetCB), mainWnd);
gtk_signal_connect(GTK_OBJECT(mainWnd), "selection_clear_event",
GTK_SIGNAL_FUNC(CopyPasteSelectionClearCB), mainWnd);
+#else
+ g_signal_connect(G_OBJECT(mainWnd), "selection_received",
+ G_CALLBACK(CopyPasteSelectionReceivedCB), mainWnd);
+ g_signal_connect(G_OBJECT(mainWnd), "selection_get",
+ G_CALLBACK(CopyPasteSelectionGetCB), mainWnd);
+ g_signal_connect(G_OBJECT(mainWnd), "selection_clear_event",
+ G_CALLBACK(CopyPasteSelectionClearCB), mainWnd);
+#endif
CopyPasteStateInit();
CopyPaste_Unregister(GtkWidget* mainWnd)
{
g_debug("%s: enter\n", __FUNCTION__);
+#ifndef GTK3
gtk_signal_disconnect_by_func(GTK_OBJECT(mainWnd),
GTK_SIGNAL_FUNC(CopyPasteSelectionReceivedCB),
mainWnd);
gtk_signal_disconnect_by_func(GTK_OBJECT(mainWnd),
GTK_SIGNAL_FUNC(CopyPasteSelectionClearCB),
mainWnd);
+#else
+ g_signal_handlers_disconnect_by_func(G_OBJECT(mainWnd),
+ G_CALLBACK(CopyPasteSelectionReceivedCB),
+ mainWnd);
+ g_signal_handlers_disconnect_by_func(G_OBJECT(mainWnd),
+ G_CALLBACK(CopyPasteSelectionGetCB),
+ mainWnd);
+ g_signal_handlers_disconnect_by_func(G_OBJECT(mainWnd),
+ G_CALLBACK(CopyPasteSelectionClearCB),
+ mainWnd);
+#endif
}
}
gUserMainWidget = gtk_invisible_new();
+#ifndef GTK3
gXDisplay = GDK_WINDOW_XDISPLAY(gUserMainWidget->window);
+#else
+ gXDisplay = GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gUserMainWidget));
+#endif
gXRoot = RootWindow(gXDisplay, DefaultScreen(gXDisplay));
/*
if (CPClipboard_ItemExists(clip, CPFORMAT_TEXT) ||
CPClipboard_ItemExists(clip, CPFORMAT_RTF)) {
- std::list<Gtk::TargetEntry> targets;
+ std::vector<Gtk::TargetEntry> targets;
/*
* rtf should be first in the target list otherwise OpenOffice may not
GuestCopyPasteMgr *mCP;
bool mClipboardEmpty;
utf::string mHGStagingDir;
- std::list<Gtk::TargetEntry> mListTargets;
+ std::vector<Gtk::TargetEntry> mListTargets;
bool mIsClipboardOwner;
uint64 mClipTime;
uint64 mPrimTime;
TRACE_CALL();
/* Construct supported target list for HG DnD. */
- std::list<Gtk::TargetEntry> targets;
+ std::vector<Gtk::TargetEntry> targets;
/* File DnD. */
targets.push_back(Gtk::TargetEntry(DRAG_TARGET_NAME_URI_LIST));
* Construct the target and action list, as well as a fake motion notify
* event that's consistent with one that would typically start a drag.
*/
- targets = Gtk::TargetList::create(std::list<Gtk::TargetEntry>());
+ targets = Gtk::TargetList::create(std::vector<Gtk::TargetEntry>());
if (CPClipboard_ItemExists(&mClipboard, CPFORMAT_FILELIST)) {
mHGStagingDir = stagingDir;
event.axes = NULL;
event.state = GDK_BUTTON1_MASK;
event.is_hint = 0;
+#ifndef GTK3
event.device = gdk_device_get_core_pointer();
+#else
+ GdkDeviceManager* manager = gdk_display_get_device_manager(gdk_window_get_display(event.window));
+ event.device = gdk_device_manager_get_client_pointer(manager);
+#endif
event.x_root = mOrigin.get_x();
event.y_root = mOrigin.get_y();
// If we are the context of a DnD, send DnD feedback to the source.
DND_DROPEFFECT effect;
+#ifndef GTK3
effect = ToDropEffect((Gdk::DragAction)(mDragCtx->action));
+#else
+ effect = ToDropEffect((Gdk::DragAction)(gdk_drag_context_get_selected_action(mDragCtx)));
+#endif
if (effect != mEffect) {
mEffect = effect;
g_debug("%s: Updating feedback\n", __FUNCTION__);
* Gdk::DragContext::get_targets, but API/ABI broke between 2.10 and
* 2.12, so we work around it like this for now.
*/
+#ifndef GTK3
Glib::ListHandle<std::string, Gdk::AtomStringTraits> targets(
dc->gobj()->targets, Glib::OWNERSHIP_NONE);
+#else
+ Glib::ListHandle<std::string, Gdk::AtomStringTraits> targets(
+ gdk_drag_context_list_targets(dc->gobj()), Glib::OWNERSHIP_NONE);
+#endif
- std::list<Glib::ustring> as = targets;
- std::list<Glib::ustring>::iterator result;
+ std::vector<Glib::ustring> as = targets;
+ std::vector<Glib::ustring>::iterator result;
char *pid;
pid = Str_Asprintf(NULL, "guest-dnd-target %d", static_cast<int>(getpid()));
if (pid) {
guint time) // IN: event timestamp
{
Glib::RefPtr<Gtk::TargetList> targets;
- targets = Gtk::TargetList::create(std::list<Gtk::TargetEntry>());
+ targets = Gtk::TargetList::create(std::vector<Gtk::TargetEntry>());
CPClipboard_Clear(&mClipboard);
mNumPendingRequest = 0;
g_debug("%s: unable to get widget\n", __FUNCTION__);
return false;
}
-
+#ifndef GTK3
dndXDisplay = GDK_WINDOW_XDISPLAY(widget->window);
dndXWindow = GDK_WINDOW_XWINDOW(widget->window);
+#else
+ dndXDisplay = GDK_WINDOW_XDISPLAY(gtk_widget_get_window(widget));
+ dndXWindow = GDK_WINDOW_XID(gtk_widget_get_window(widget));
+#endif
rootWnd = RootWindow(dndXDisplay, DefaultScreen(dndXDisplay));
/*
if (showWidget) {
g_debug("%s: showing Gtk widget\n", __FUNCTION__);
gtk_widget_show(widget);
+#ifndef GTK3
gdk_window_show(widget->window);
+#else
+ gdk_window_show(gtk_widget_get_window(widget));
+#endif
}
/* Get the current location of the mouse if coordinates weren't provided. */
g_debug("%s: unable to get widget\n", __FUNCTION__);
return false;
}
-
+#ifndef GTK3
dndXDisplay = GDK_WINDOW_XDISPLAY(widget->window);
+#else
+ dndXDisplay = GDK_WINDOW_XDISPLAY(gtk_widget_get_window(widget));
+#endif
/* First get list of all input device. */
if (!(list = XListInputDevices (dndXDisplay, &numDevices))) {
void
DragDetWnd::GetGeometry(int &x, int &y, int &width, int &height)
{
- int dummy;
-
Glib::RefPtr<Gdk::Window> gdkwin = get_window();
if (gdkwin) {
+#ifndef GTK3
+ int dummy;
gdkwin->get_geometry(x, y, width, height, dummy);
+#else
+ gdkwin->get_geometry(x, y, width, height);
+#endif
#if defined(DETWNDTEST)
Flush();
#endif
XSetErrorHandler(ResolutionX11ErrorHandler);
gtk_init(&argc, (char ***) &argv);
wnd = gtk_invisible_new();
+#ifndef GTK3
display = GDK_WINDOW_XDISPLAY(wnd->window);
+#else
+ display = GDK_WINDOW_XDISPLAY(gtk_widget_get_window(wnd));
+#endif
if (!display)
g_error("%s: Invalid display detected.\n", __func__);