30
by mvo
* added basic hal support. |
1 |
/*
|
2 |
* src/clipboard.c - X clipboard hack to detect if daemon is running
|
|
3 |
*
|
|
4 |
* Elliot Lee <sopwith@redhat.com>
|
|
5 |
*
|
|
6 |
* (C) Copyright 1999 Red Hat, Inc.
|
|
7 |
*
|
|
8 |
* Licensed under the GNU GPL v2. See COPYING.
|
|
9 |
*/
|
|
10 |
||
11 |
#include "config.h" |
|
12 |
||
13 |
#include <gconf/gconf-client.h> |
|
14 |
#include <gdk/gdkx.h> |
|
15 |
||
35
by mvo
* big rename: upgrade-notifier -> update-notifier |
16 |
#include "update-notifier.h" |
30
by mvo
* added basic hal support. |
17 |
|
18 |
/*
|
|
19 |
* clipboard_get_func - dummy get_func for gtk_clipboard_set_with_data ()
|
|
20 |
*/
|
|
21 |
static void |
|
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__))) |
|
26 |
{
|
|
27 |
}
|
|
28 |
||
29 |
/*
|
|
30 |
* clipboard_clear_func - dummy clear_func for gtk_clipboard_set_with_data ()
|
|
31 |
*/
|
|
32 |
static void |
|
33 |
clipboard_clear_func (GtkClipboard *clipboard __attribute__((__unused__)), |
|
34 |
gpointer user_data_or_owner __attribute__((__unused__))) |
|
35 |
{
|
|
36 |
}
|
|
37 |
||
38 |
/*
|
|
39 |
* up_get_clipboard - try and get the CLIPBOARD_NAME clipboard
|
|
40 |
*
|
|
41 |
* Returns TRUE if successfully retrieved and FALSE otherwise.
|
|
42 |
*/
|
|
43 |
gboolean
|
|
44 |
up_get_clipboard (void) |
|
45 |
{
|
|
46 |
static const GtkTargetEntry targets[] = { {CLIPBOARD_NAME, 0, 0} }; |
|
47 |
gboolean retval = FALSE; |
|
48 |
GtkClipboard *clipboard; |
|
49 |
Atom atom; |
|
595.1.1
by Michael Terry
* Add --disable-deprecations configure flag to test for deprecated API use |
50 |
Display *display; |
30
by mvo
* added basic hal support. |
51 |
|
52 |
atom = gdk_x11_get_xatom_by_name (CLIPBOARD_NAME); |
|
595.1.1
by Michael Terry
* Add --disable-deprecations configure flag to test for deprecated API use |
53 |
display = gdk_x11_display_get_xdisplay (gdk_display_get_default ()); |
54 |
||
55 |
XGrabServer (display); |
|
56 |
||
57 |
if (XGetSelectionOwner (display, atom) != None) |
|
30
by mvo
* added basic hal support. |
58 |
goto out; |
59 |
||
60 |
clipboard = gtk_clipboard_get (gdk_atom_intern (CLIPBOARD_NAME, FALSE)); |
|
61 |
||
62 |
if (gtk_clipboard_set_with_data (clipboard, targets, |
|
63 |
G_N_ELEMENTS (targets), |
|
64 |
clipboard_get_func, |
|
65 |
clipboard_clear_func, NULL)) |
|
66 |
retval = TRUE; |
|
67 |
||
68 |
out: |
|
595.1.1
by Michael Terry
* Add --disable-deprecations configure flag to test for deprecated API use |
69 |
XUngrabServer (display); |
30
by mvo
* added basic hal support. |
70 |
gdk_flush (); |
71 |
||
72 |
return retval; |
|
73 |
}
|