1 | /*----------------------------------------------------------------------* |
1 | /*----------------------------------------------------------------------* |
2 | * File: rxvttoolkit.h - provide toolkit-functionality for rxvt. |
2 | * File: rxvttoolkit.h - provide toolkit-functionality for rxvt. |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * All portions of code are copyright by their respective author/s. |
5 | * All portions of code are copyright by their respective author/s. |
6 | * Copyright (c) 2003-2006 Marc Lehmann <pcg@goof.com> |
6 | * Copyright (c) 2003-2011 Marc Lehmann <schmorp@schmorp.de> |
7 | * Copyright (c) 2011 Emanuele Giaquinta <e.giaquinta@glauco.it> |
7 | * Copyright (c) 2011 Emanuele Giaquinta <e.giaquinta@glauco.it> |
8 | * |
8 | * |
9 | * This program is free software; you can redistribute it and/or modify |
9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by |
10 | * it under the terms of the GNU General Public License as published by |
11 | * the Free Software Foundation; either version 2 of the License, or |
11 | * the Free Software Foundation; either version 2 of the License, or |
… | |
… | |
363 | #define Sel_Clipboard 0x03 |
363 | #define Sel_Clipboard 0x03 |
364 | #define Sel_whereMask 0x0f |
364 | #define Sel_whereMask 0x0f |
365 | #define Sel_CompoundText 0x10 /* last request was COMPOUND_TEXT */ |
365 | #define Sel_CompoundText 0x10 /* last request was COMPOUND_TEXT */ |
366 | #define Sel_UTF8String 0x20 /* last request was UTF8_STRING */ |
366 | #define Sel_UTF8String 0x20 /* last request was UTF8_STRING */ |
367 | |
367 | |
368 | typedef void (*sel_cb)(char *data, unsigned int len, struct rxvt_selection *rs, void *ptr); |
|
|
369 | |
|
|
370 | struct rxvt_selection |
368 | struct rxvt_selection |
371 | { |
369 | { |
372 | rxvt_selection (rxvt_display *disp, int selnum, Time tm, Window win, Atom prop, sel_cb cb, void *ptr); |
370 | rxvt_selection (rxvt_display *disp, int selnum, Time tm, Window win, Atom prop, rxvt_term *term); |
373 | void run (); |
371 | void run (); |
374 | ~rxvt_selection (); |
372 | ~rxvt_selection (); |
375 | |
373 | |
376 | private: |
374 | rxvt_term *term; // terminal to paste to, may be 0 |
|
|
375 | void *cb_sv; // managed by perl |
|
|
376 | |
377 | rxvt_display *display; |
377 | rxvt_display *display; |
378 | Time request_time; |
378 | Time request_time; |
379 | Window request_win; |
379 | Window request_win; |
380 | Atom request_prop; |
380 | Atom request_prop; |
381 | sel_cb request_cb; |
|
|
382 | void *user_data; |
|
|
383 | |
381 | |
|
|
382 | private: |
384 | unsigned char selection_wait; |
383 | unsigned char selection_wait; |
385 | unsigned char selection_type; |
384 | unsigned char selection_type; |
386 | |
385 | |
387 | char *incr_buf; |
386 | char *incr_buf; |
388 | size_t incr_buf_size, incr_buf_fill; |
387 | size_t incr_buf_size, incr_buf_fill; |
389 | |
388 | |
390 | void timer_cb (ev::timer &w, int revents); ev::timer timer_ev; |
389 | void timer_cb (ev::timer &w, int revents); ev::timer timer_ev; |
391 | void x_cb (XEvent &xev); xevent_watcher x_ev; |
390 | void x_cb (XEvent &xev); xevent_watcher x_ev; |
392 | |
391 | |
|
|
392 | void finish (char *data = 0, unsigned int len = 0); |
393 | void stop (); |
393 | void stop (); |
394 | bool request (Atom target, int selnum); |
394 | bool request (Atom target, int selnum); |
395 | void handle_selection (Window win, Atom prop, bool delete_prop); |
395 | void handle_selection (Window win, Atom prop, bool delete_prop); |
396 | }; |
396 | }; |
397 | |
397 | |