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

Comparing rxvt-unicode/src/rxvttoolkit.h (file contents):
Revision 1.37 by root, Fri Dec 14 04:26:23 2007 UTC vs.
Revision 1.50 by sf-exg, Fri Feb 11 01:24:46 2011 UTC

29# include <X11/Xft/Xft.h> 29# include <X11/Xft/Xft.h>
30#endif 30#endif
31 31
32#include "ev_cpp.h" 32#include "ev_cpp.h"
33 33
34#include "rxvtlib.h"
35#include "rxvtutil.h" 34#include "rxvtutil.h"
36 35
37#include "callback.h" 36#include "callback.h"
38 37
39// see rxvttoolkit.C:xa_names, which must be kept in sync 38// see rxvttoolkit.C:xa_names, which must be kept in sync
60#if ENABLE_EWMH 59#if ENABLE_EWMH
61 XA_NET_WM_PID, 60 XA_NET_WM_PID,
62 XA_NET_WM_NAME, 61 XA_NET_WM_NAME,
63 XA_NET_WM_ICON_NAME, 62 XA_NET_WM_ICON_NAME,
64 XA_NET_WM_PING, 63 XA_NET_WM_PING,
64 XA_NET_WM_ICON,
65#endif 65#endif
66#if USE_XIM 66#if USE_XIM
67 XA_WM_LOCALE_NAME, 67 XA_WM_LOCALE_NAME,
68 XA_XIM_SERVERS, 68 XA_XIM_SERVERS,
69#endif 69#endif
74#if ENABLE_XEMBED 74#if ENABLE_XEMBED
75 XA_XEMBED, 75 XA_XEMBED,
76 XA_XEMBED_INFO, 76 XA_XEMBED_INFO,
77#endif 77#endif
78#if !ENABLE_MINIMAL 78#if !ENABLE_MINIMAL
79 // these are usually allocated by other subsystens, but we do it 79 // these are usually allocated by other subsystems, but we do it
80 // here to avoid a server roundtrip. 80 // here to avoid a server roundtrip.
81 XA_SCREEN_RESOURCES, 81 XA_SCREEN_RESOURCES,
82 XA_XDCCC_LINEAR_RGB_CORRECTION, 82 XA_XDCCC_LINEAR_RGB_CORRECTION,
83 XA_XDCCC_LINEAR_RGB_MATRICES, 83 XA_XDCCC_LINEAR_RGB_MATRICES,
84 XA_WM_COLORMAP_WINDOWS, 84 XA_WM_COLORMAP_WINDOWS,
219 219
220struct rxvt_display : refcounted 220struct rxvt_display : refcounted
221{ 221{
222 event_vec<xevent_watcher> xw; 222 event_vec<xevent_watcher> xw;
223 223
224 ev::prepare flush_ev; void flush_cb (ev::prepare &w, int revents);
224 ev::io x_ev; void x_cb (ev::io &w, int revents); 225 ev::io x_ev ; void x_cb (ev::io &w, int revents);
225 226
226#ifdef USE_XIM 227#ifdef USE_XIM
227 refcache<rxvt_xim> xims; 228 refcache<rxvt_xim> xims;
228 vector<im_watcher *> imw; 229 vector<im_watcher *> imw;
229 230
234//public 235//public
235 Display *dpy; 236 Display *dpy;
236 int screen; 237 int screen;
237 Window root; 238 Window root;
238 rxvt_term *selection_owner; 239 rxvt_term *selection_owner;
240 rxvt_term *clipboard_owner;
239 Atom xa[NUM_XA]; 241 Atom xa[NUM_XA];
240 bool is_local; 242 bool is_local;
241#ifdef POINTER_BLANK 243#ifdef POINTER_BLANK
242 Cursor blank_cursor; 244 Cursor blank_cursor;
243#endif 245#endif
246 XrmDatabase get_resources (bool refresh); 248 XrmDatabase get_resources (bool refresh);
247 bool ref_init (); 249 bool ref_init ();
248 void ref_next (); 250 void ref_next ();
249 ~rxvt_display (); 251 ~rxvt_display ();
250 252
251 void flush (); 253 void flush ()
254 {
255 flush_ev.start ();
256 }
257
252 Atom atom (const char *name); 258 Atom atom (const char *name);
253 void set_selection_owner (rxvt_term *owner); 259 void set_selection_owner (rxvt_term *owner, bool clipboard);
254 260
255 void reg (xevent_watcher *w); 261 void reg (xevent_watcher *w);
256 void unreg (xevent_watcher *w); 262 void unreg (xevent_watcher *w);
257 263
258#ifdef USE_XIM 264#ifdef USE_XIM
263 void put_xim (rxvt_xim *xim); 269 void put_xim (rxvt_xim *xim);
264#endif 270#endif
265}; 271};
266 272
267#ifdef USE_XIM 273#ifdef USE_XIM
268struct im_watcher : rxvt_watcher, callback<void (void)> { 274struct im_watcher : rxvt_watcher, callback<void (void)>
275{
269 void start (rxvt_display *display) 276 void start (rxvt_display *display)
270 { 277 {
271 display->reg (this); 278 display->reg (this);
272 } 279 }
273 280
325 operator Pixel () const { return c.pixel; } 332 operator Pixel () const { return c.pixel; }
326 333
327 bool operator == (const rxvt_color &b) const { return Pixel (*this) == Pixel (b); } 334 bool operator == (const rxvt_color &b) const { return Pixel (*this) == Pixel (b); }
328 bool operator != (const rxvt_color &b) const { return Pixel (*this) != Pixel (b); } 335 bool operator != (const rxvt_color &b) const { return Pixel (*this) != Pixel (b); }
329 336
337 bool is_opaque () const
338 {
339#if XFT
340 return c.color.alpha == rgba::MAX_CC;
341#else
342 return 1;
343#endif
344 }
345
330 bool alloc (rxvt_screen *screen, const rgba &color); 346 bool alloc (rxvt_screen *screen, const rgba &color);
331 void free (rxvt_screen *screen); 347 void free (rxvt_screen *screen);
332 348
333 void get (rgba &color); 349 void get (rgba &color);
334 void get (XColor &color); 350 void get (XColor &color);
337 bool set (rxvt_screen *screen, const rgba &color); 353 bool set (rxvt_screen *screen, const rgba &color);
338 354
339 void fade (rxvt_screen *screen, int percent, rxvt_color &result, const rgba &to = rgba (0, 0, 0)); 355 void fade (rxvt_screen *screen, int percent, rxvt_color &result, const rgba &to = rgba (0, 0, 0));
340}; 356};
341 357
342#if TRACE_PIXMAPS 358#define Sel_normal 0x01 /* normal selection */
343Pixmap trace_XCreatePixmap (const char *file, int line, Display *dpy, Window r, unsigned int w, unsigned int h, unsigned int d); 359#define Sel_incr 0x02 /* incremental selection */
344void trace_XFreePixmap (const char *file, int line, Display *dpy, Pixmap p); 360#define Sel_Primary 0x01
361#define Sel_Secondary 0x02
362#define Sel_Clipboard 0x03
363#define Sel_whereMask 0x0f
364#define Sel_CompoundText 0x10 /* last request was COMPOUND_TEXT */
365#define Sel_UTF8String 0x20 /* last request was UTF8_STRING */
345 366
346# define XCreatePixmap(dpy,r,w,h,d) trace_XCreatePixmap (__FILE__,__LINE__,dpy,r,w,h,d) 367typedef void (*sel_cb)(char *data, unsigned int len, struct rxvt_selection *rs, void *ptr);
347# define XFreePixmap(dpy,p) trace_XFreePixmap (__FILE__,__LINE__,dpy,p)
348#endif
349 368
350#endif 369struct rxvt_selection
370{
371 rxvt_selection (rxvt_display *disp, int selnum, Time tm, Window win, Atom prop, sel_cb cb, void *ptr);
372 ~rxvt_selection ();
351 373
374private:
375 rxvt_display *display;
376 Time request_time;
377 Window request_win;
378 Atom request_prop;
379 sel_cb request_cb;
380 void *user_data;
381
382 unsigned char selection_wait;
383 unsigned char selection_type;
384
385 char *incr_buf;
386 size_t incr_buf_size, incr_buf_fill;
387
388 void timer_cb (ev::timer &w, int revents); ev::timer timer_ev;
389 void x_cb (XEvent &xev); xevent_watcher x_ev;
390
391 void stop ();
392 bool request (Atom target, int selnum);
393 void handle_selection (Window win, Atom prop, bool delete_prop);
394};
395
396#endif
397

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines