2
* src/clipboard.c - X clipboard hack to detect if daemon is running
4
* Elliot Lee <sopwith@redhat.com>
6
* (C) Copyright 1999 Red Hat, Inc.
8
* Licensed under the GNU GPL v2. See COPYING.
13
#include <gconf/gconf-client.h>
16
#include "update-notifier.h"
19
* clipboard_get_func - dummy get_func for gtk_clipboard_set_with_data ()
22
clipboard_get_func (GtkClipboard *clipboard __attribute__((__unused__)),
23
GtkSelectionData *selection_data __attribute__((__unused__)),
24
guint info __attribute__((__unused__)),
25
gpointer user_data_or_owner __attribute__((__unused__)))
30
* clipboard_clear_func - dummy clear_func for gtk_clipboard_set_with_data ()
33
clipboard_clear_func (GtkClipboard *clipboard __attribute__((__unused__)),
34
gpointer user_data_or_owner __attribute__((__unused__)))
39
* up_get_clipboard - try and get the CLIPBOARD_NAME clipboard
41
* Returns TRUE if successfully retrieved and FALSE otherwise.
44
up_get_clipboard (void)
46
static const GtkTargetEntry targets[] = { {CLIPBOARD_NAME, 0, 0} };
47
gboolean retval = FALSE;
48
GtkClipboard *clipboard;
52
atom = gdk_x11_get_xatom_by_name (CLIPBOARD_NAME);
53
display = gdk_x11_display_get_xdisplay (gdk_display_get_default ());
55
XGrabServer (display);
57
if (XGetSelectionOwner (display, atom) != None)
60
clipboard = gtk_clipboard_get (gdk_atom_intern (CLIPBOARD_NAME, FALSE));
62
if (gtk_clipboard_set_with_data (clipboard, targets,
63
G_N_ELEMENTS (targets),
65
clipboard_clear_func, NULL))
69
XUngrabServer (display);