editor/gtk: Save the clipboard on exit

Normally, this is done by gtk_main with a private function. Since Clonk
does not use gtk_main, that function is copied and slightly changed to use
the public API and compile as C++.
stable-5.1
Günther Brammer 2011-01-16 21:30:59 +01:00
parent b03f6381fb
commit b3a34fea69
1 changed files with 30 additions and 0 deletions

View File

@ -180,8 +180,38 @@ bool CStdApp::Init(int argc, char * argv[])
return DoInit (argc, argv);
}
#ifdef WITH_GLIB
static void
gtk_clipboard_store_all (void)
{
GtkClipboard *clipboard;
GSList *displays, *list;
displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
list = displays;
while (list)
{
GdkDisplay *display = static_cast<GdkDisplay *>(list->data);
clipboard = gtk_clipboard_get_for_display (display, GDK_SELECTION_CLIPBOARD);
if (clipboard)
gtk_clipboard_store (clipboard);
list = list->next;
}
g_slist_free (displays);
}
#endif
void CStdApp::Clear()
{
#ifdef WITH_GLIB
gtk_clipboard_store_all();
#endif
XCloseDisplay(dpy);
dpy = 0;
#if USE_CONSOLE && HAVE_LIBREADLINE