~ubuntu-branches/ubuntu/natty/sawfish/natty

« back to all changes in this revision

Viewing changes to src/selection.c

  • Committer: Bazaar Package Importer
  • Author(s): Luis Rodrigo Gallardo Cruz
  • Date: 2009-11-23 09:05:20 UTC
  • mfrom: (0.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: james.westby@ubuntu.com-20091123090520-m588qe37wtxzr2b5
Tags: upstream-1.5.3
ImportĀ upstreamĀ versionĀ 1.5.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* selection.c -- selection handling (only retrieving)
2
 
   $Id: selection.c 4301 2008-11-19 20:45:08Z chrisb $
 
2
   $Id$
3
3
 
4
4
   Copyright (C) 2000 John Harper <john@dcs.warwick.ac.uk>
5
5
 
6
6
   Originally adapted from the Jade sources by Mark Probst.
7
7
 
8
 
   This file is part of sawmill.
 
8
   This file is part of sawfish.
9
9
 
10
 
   sawmill is free software; you can redistribute it and/or modify it
 
10
   sawfish is free software; you can redistribute it and/or modify it
11
11
   under the terms of the GNU General Public License as published by
12
12
   the Free Software Foundation; either version 2, or (at your option)
13
13
   any later version.
14
14
 
15
 
   sawmill is distributed in the hope that it will be useful, but
 
15
   sawfish is distributed in the hope that it will be useful, but
16
16
   WITHOUT ANY WARRANTY; without even the implied warranty of
17
17
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
18
   GNU General Public License for more details.
19
19
 
20
20
   You should have received a copy of the GNU General Public License
21
 
   along with sawmill; see the file COPYING.   If not, write to
 
21
   along with sawfish; see the file COPYING.   If not, write to
22
22
   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
23
23
 
24
 
#include "sawmill.h"
 
24
#include "sawfish.h"
25
25
#include <string.h>
26
26
#include <X11/Xatom.h>
27
27
 
28
28
/* selection functions */
29
29
 
30
 
static Atom sawmill_selection;
 
30
static Atom sawfish_selection;
31
31
 
32
32
static inline Atom
33
33
symbol_to_atom (repv sym)
78
78
        XEvent ev;
79
79
        Window sel_window = no_focus_window;
80
80
        XConvertSelection (dpy, selection, XA_STRING,
81
 
                           sawmill_selection, sel_window, last_event_time);
 
81
                           sawfish_selection, sel_window, last_event_time);
82
82
        XIfEvent (dpy, &ev, selnotify_pred, (XPointer) 0);
83
83
        if (ev.xselection.property != None)
84
84
        {
89
89
            unsigned char *prop;          
90
90
            int r;
91
91
            int offset;
92
 
            r = XGetWindowProperty (dpy, sel_window, sawmill_selection,
 
92
            r = XGetWindowProperty (dpy, sel_window, sawfish_selection,
93
93
                                    0, 0, False, AnyPropertyType,
94
94
                                    &actual_type, &actual_format,
95
95
                                    &nitems, &bytes_after, &prop);
104
104
            offset = 0;
105
105
            while (bytes_after > 0)
106
106
            {
107
 
                r = XGetWindowProperty (dpy, sel_window, sawmill_selection,
 
107
                r = XGetWindowProperty (dpy, sel_window, sawfish_selection,
108
108
                                        offset/4, (bytes_after / 4) + 1,
109
109
                                        False, AnyPropertyType,
110
110
                                        &actual_type, &actual_format,
115
115
                XFree (prop);
116
116
                offset += nitems;
117
117
            }
118
 
            XDeleteProperty (dpy, sel_window, sawmill_selection);
 
118
            XDeleteProperty (dpy, sel_window, sawfish_selection);
119
119
            rep_STR(res)[offset] = 0;
120
120
        }
121
121
    }
134
134
    rep_ADD_SUBR (Sx_get_selection);
135
135
 
136
136
    if (dpy != 0)
137
 
        sawmill_selection = XInternAtom (dpy, "SAWMILL_SELECTION", False);
 
137
        sawfish_selection = XInternAtom (dpy, "SAWFISH_SELECTION", False);
138
138
 
139
139
    return rep_pop_structure (tem);
140
140
}