ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtcolor.C
(Generate patch)

Comparing rxvt-unicode/src/rxvtcolor.C (file contents):
Revision 1.12 by pcg, Fri Apr 2 20:41:01 2004 UTC vs.
Revision 1.15 by root, Sun May 30 19:12:42 2004 UTC

1/*--------------------------------*-C-*---------------------------------*
2 * File: rxvtcolor.C
3 *----------------------------------------------------------------------*
4 *
5 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *----------------------------------------------------------------------*/
22
1#include "../config.h" 23#include "../config.h"
2#include <rxvt.h> 24#include <rxvt.h>
3#include <rxvtcolor.h> 25#include <rxvtcolor.h>
4 26
5#include <unistd.h> 27#include <unistd.h>
33} 55}
34 56
35template<class T> 57template<class T>
36T *refcache<T>::get (const char *id) 58T *refcache<T>::get (const char *id)
37{ 59{
38 for (T **i = begin (); i < end (); ++i) 60 for (T **i = this->begin (); i < this->end (); ++i)
39 { 61 {
40 if (!strcmp (id, (*i)->id)) 62 if (!strcmp (id, (*i)->id))
41 { 63 {
42 (*i)->referenced++; 64 (*i)->referenced++;
43 return *i; 65 return *i;
48 70
49 obj->referenced = 1; 71 obj->referenced = 1;
50 72
51 if (obj && obj->init ()) 73 if (obj && obj->init ())
52 { 74 {
53 push_back (obj); 75 this->push_back (obj);
54 return obj; 76 return obj;
55 } 77 }
56 else 78 else
57 { 79 {
58 delete obj; 80 delete obj;
66 if (!obj) 88 if (!obj)
67 return; 89 return;
68 90
69 if (!--obj->referenced) 91 if (!--obj->referenced)
70 { 92 {
71 erase (find (begin (), end (), obj)); 93 this->erase (find (this->begin (), this->end (), obj));
72 delete obj; 94 delete obj;
73 } 95 }
74} 96}
75 97
76template<class T> 98template<class T>
77refcache<T>::~refcache () 99refcache<T>::~refcache ()
78{ 100{
79 while (size ()) 101 while (this->size ())
80 put (*begin ()); 102 put (*this->begin ());
81} 103}
82 104
83///////////////////////////////////////////////////////////////////////////// 105/////////////////////////////////////////////////////////////////////////////
84 106
85static void 107static void
158 } 180 }
159#endif 181#endif
160 182
161 int fd = XConnectionNumber (display); 183 int fd = XConnectionNumber (display);
162 x_ev.start (fd, EVENT_READ); 184 x_ev.start (fd, EVENT_READ);
163 fcntl (fd, F_SETFL, FD_CLOEXEC); 185 fcntl (fd, F_SETFD, FD_CLOEXEC);
164 186
165 XSelectInput (display, root, PropertyChangeMask); 187 XSelectInput (display, root, PropertyChangeMask);
166 xa_xim_servers = XInternAtom (display, "XIM_SERVERS", 0); 188 xa_xim_servers = XInternAtom (display, "XIM_SERVERS", 0);
167 189
168 flush (); 190 flush ();
285 return XInternAtom (display, name, False); 307 return XInternAtom (display, name, False);
286} 308}
287 309
288///////////////////////////////////////////////////////////////////////////// 310/////////////////////////////////////////////////////////////////////////////
289 311
290template refcache<rxvt_display>; 312template class refcache<rxvt_display>;
291refcache<rxvt_display> displays; 313refcache<rxvt_display> displays;
292 314
293///////////////////////////////////////////////////////////////////////////// 315/////////////////////////////////////////////////////////////////////////////
294 316
295bool 317bool

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines