forked from Mirrors/openclonk
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++.
parent
2c612c6425
commit
5b3fe189ea
|
@ -181,8 +181,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
|
||||
|
|
Loading…
Reference in New Issue