1 /*****
2  *       Xnee's Not an Event Emulator
3  *
4  * Xnee enables recording and replaying of X protocol data
5  *
6  *   Copyright (C) 1999-2011, 2013, 2014  Henrik Sandklef
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 3
11  * of the License, or any later version.
12  *
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Boston,
22  * MA  02110-1301, USA.
23  ****/
24 #ifndef XNEE_SETGET_H
25 #define XNEE_SETGET_H
26 
27 #include "libxnee/xnee.h"
28 #include "libxnee/xnee_record.h"
29 #include "libxnee/xnee_replay.h"
30 
31 
32 #define xnee_set_events_replayed(xd,n)   xd->xnee_info.replayed_events=n;
33 #define xnee_inc_events_replayed(xd)     xd->xnee_info.replayed_events++;
34 #define xnee_get_events_replayed(xd)     xd->xnee_info.replayed_events;
35 
36 /**
37  *
38  *
39  * @param xd    xnee's main structure
40  * @param disp  name of the X display to set
41  *
42  * This functions is called to set the display name of the
43  * main display for Xnee.
44  *
45  * @return      0 on success
46  */
47 int
48 xnee_set_display_name (xnee_data *xd, const char *disp);
49 
50 /**
51  *
52  *
53  * @param xd    xnee's main structure
54  *
55  * This functions is called to get the display name of the
56  * display used in Xnee.
57  *
58  * @return      display
59  */
60 char*
61 xnee_get_display_name (xnee_data *xd);
62 
63 
64 /**
65  *
66  *
67  * @param xd    xnee's main structure
68  *
69  * This functions is called to get the display of the
70  * control display for Xnee.
71  *
72  * @return
73  */
74 Display *
75 xnee_get_control_display(xnee_data *xd);
76 
77 /**
78  *
79  *
80  * @param xd    xnee's main structure
81  *
82  * This functions is called to get the display of the
83  * data display for Xnee.
84  *
85  * @return
86  */
87 Display *
88 xnee_get_data_display(xnee_data *xd);
89 
90 /**
91  *
92  *
93  * @param xd    xnee's main structure
94  *
95  * This functions is called to get the display of the
96  * grab display for Xnee.
97  *
98  * @return      display
99  */
100 Display *
101 xnee_get_grab_display(xnee_data *xd);
102 
103 
104 /**
105  *
106  *
107  * @param xd    xnee's main structure
108  * @param out   file descriptor to use for printout
109  *
110  * @return
111  */
112 int
113 xnee_set_out_file (xnee_data *xd, FILE* out);
114 
115 
116 /**
117  *
118  *
119  * @param xd    xnee's main structure
120  *
121  * @return      file descriptor to use for printout
122  */
123 FILE*
124 xnee_get_out_file (xnee_data *xd);
125 
126 /**
127  *
128  *
129  * @param xd         xnee's main structure
130  * @param out_name   file name to use for printout
131  *
132  * @return
133  */
134 int
135 xnee_set_out_name (xnee_data *xd, char* out_name);
136 
137 /**
138  *
139  *
140  * @param xd         xnee's main structure
141  *
142  * @return           file name to use for printout
143  */
144 char *
145 xnee_get_out_name (xnee_data *xd);
146 
147 
148 /**
149  *
150  *
151  * @param xd    xnee's main structure
152  * @param rt    file descriptor to use for retype
153  *
154  * @return
155  */
156 int
157 xnee_set_rt_file (xnee_data *xd, FILE* rt);
158 
159 /**
160  *
161  *
162  * @param xd    xnee's main structure
163  *
164  * @return      file descriptor to use for retype
165  */
166 FILE*
167 xnee_get_rt_file (xnee_data *xd);
168 
169 /**
170  *
171  *
172  * @param xd         xnee's main structure
173  *
174  * @return           file name to use for retype
175  */
176 int
177 xnee_set_rt_name (xnee_data *xd, char* rt_name);
178 
179 /**
180  *
181  *
182  * @param xd         xnee's main structure
183  *
184  * @return           file name to use for retype
185  */
186 char *
187 xnee_get_rt_name (xnee_data *xd);
188 
189 
190 /**
191  *
192  *
193  * @param xd        xnee's main structure
194  * @param err       file decriptor to use for error prints
195  *
196  * @return          0 on success
197  */
198 int
199 xnee_set_err_file (xnee_data *xd, FILE* err);
200 
201 /**
202  *
203  *
204  * @param xd    xnee's main structure
205  *
206  * @return      file descriptor to use for error prints
207  */
208 FILE*
209 xnee_get_err_file (xnee_data *xd);
210 
211 
212 /**
213  *
214  *
215  * @param xd         xnee's main structure
216  * @param out_name   file name to use for error prints
217  *
218  * @return           0 on success
219  */
220 int
221 xnee_set_err_name (xnee_data *xd, char* err_name);
222 
223 
224 char *
225 xnee_get_err_name (xnee_data *xd);
226 
227 
228 int
229 xnee_set_rc_file (xnee_data *xd, FILE* rc);
230 
231 FILE*
232 xnee_get_rc_file (xnee_data *xd);
233 
234 
235 int
236 xnee_set_rc_name (xnee_data *xd, const char* rc_name);
237 
238 int
239 xnee_set_rc_byname (xnee_data *xd, const char* rc_name);
240 
241 
242 char *
243 xnee_get_rc_name (xnee_data *xd);
244 
245 
246 
247 int
248 xnee_set_data_file (xnee_data *xd, FILE* data_file);
249 
250 FILE*
251 xnee_get_data_file (xnee_data *xd);
252 
253 int
254 xnee_set_data_name (xnee_data *xd, const char* data);
255 
256 char *
257 xnee_get_data_name (xnee_data *xd);
258 
259 
260 
261 int
262 xnee_set_verbose (xnee_data *xd);
263 
264 int
265 xnee_unset_verbose (xnee_data *xd);
266 
267 int
268 xnee_get_verbose (xnee_data *xd);
269 
270 
271 int
272 xnee_is_verbose (xnee_data *xd);
273 
274 
275 int
276 xnee_set_buf_verbose (xnee_data *xd);
277 
278 int
279 xnee_unset_buf_verbose (xnee_data *xd);
280 
281 int
282 xnee_get_buf_verbose (xnee_data *xd);
283 
284 
285 
286 
287 int
288 xnee_set_all_clients (xnee_data *xd);
289 
290 
291 int
292 xnee_unset_all_clients (xnee_data *xd);
293 
294 int
295 xnee_get_all_clients (xnee_data *xd);
296 
297 int
298 xnee_is_future_clients_str(xnee_data *xd);
299 
300 int
301 xnee_is_future_clients (xnee_data *xd);
302 
303 int
304 xnee_is_all_clients (xnee_data *xd);
305 
306 
307 
308 
309 int
310 xnee_set_recorder (xnee_data *xd);
311 
312 int
313 xnee_set_replayer (xnee_data *xd);
314 
315 int
316 xnee_set_distributor (xnee_data *xd);
317 
318 int
319 xnee_set_syntax_checker (xnee_data *xd);
320 
321 int
322 xnee_set_retyper (xnee_data *xd);
323 
324 unsigned char
325 xnee_get_mode (xnee_data *xd);
326 
327 int
328 xnee_set_mode (xnee_data *xd, unsigned char mode);
329 
330 int
331 xnee_is_recorder (xnee_data *xd);
332 
333 int
334 xnee_is_replayer (xnee_data *xd);
335 
336 int
337 xnee_is_syntax_checker (xnee_data *xd);
338 
339 int
340 xnee_is_distributor (xnee_data *xd);
341 
342 int
343 xnee_is_retyper (xnee_data *xd);
344 
345 
346 
347 
348 char*
349 xnee_get_exec_prog (xnee_data *xd);
350 
351 int
352 xnee_set_key (xnee_data *xd, int mode, const char* key );
353 
354 char *
355 xnee_get_key (xnee_data *xd, int mode);
356 
357 char *
358 xnee_get_key_str (xnee_data *xd, int mode);
359 
360 char*
361 xnee_get_extra_str (xnee_data *xd, int idx);
362 
363 int
364 xnee_set_key_str (xnee_data *xd, int idx, const char *str);
365 
366 int
367 xnee_set_extra_str (xnee_data *xd, int idx, const char *str);
368 
369 int
370 xnee_set_exec_prog (xnee_data *xd, const char *prog);
371 
372 
373 #define xnee_get_stop_key(xd)        xnee_get_key_str(xd, XNEE_GRAB_STOP)
374 #define xnee_get_pause_key(xd)       xnee_get_key_str(xd, XNEE_GRAB_PAUSE)
375 #define xnee_get_resume_key(xd)      xnee_get_key_str(xd, XNEE_GRAB_RESUME)
376 #define xnee_get_insert_key(xd)      xnee_get_key_str(xd, XNEE_GRAB_INSERT)
377 #define xnee_get_exec_key(xd)        xnee_get_key_str(xd, XNEE_GRAB_EXEC)
378 
379 #define xnee_set_stop_key(xd, key)        xnee_set_key_str(xd, XNEE_GRAB_STOP, key)
380 #define xnee_set_pause_key(xd, key)       xnee_set_key_str(xd, XNEE_GRAB_PAUSE, key)
381 #define xnee_set_resume_key(xd, key)      xnee_set_key_str(xd, XNEE_GRAB_RESUME, key)
382 #define xnee_set_insert_key(xd, key)      xnee_set_key_str(xd, XNEE_GRAB_INSERT, key)
383 #define xnee_set_exec_key(xd, key)        xnee_set_key_str(xd, XNEE_GRAB_EXEC, key)
384 
385 
386 int
387 xnee_set_sync (xnee_data *xd);
388 
389 int
390 xnee_get_sync (xnee_data *xd);
391 
392 int
393 xnee_is_sync (xnee_data *xd);
394 
395 int
396 xnee_unset_sync (xnee_data *xd);
397 
398 
399 
400 
401 
402 
403 int
404 xnee_set_force_replay (xnee_data *xd);
405 
406 int
407 xnee_unset_force_replay (xnee_data *xd);
408 
409 int
410 xnee_get_force_replay (xnee_data *xd);
411 
412 int
413 xnee_is_force_replay (xnee_data *xd);
414 
415 
416 
417 
418 int
419 xnee_set_cont (xnee_data *xd);
420 
421 int
422 xnee_get_cont (xnee_data *xd);
423 
424 int
425 xnee_unset_cont (xnee_data *xd);
426 
427 int
428 xnee_is_cont (xnee_data *xd);
429 
430 
431 
432 
433 
434 int
435 set_first_replayed_event (xnee_data *xd);
436 
437 int
438 get_first_replayed_event (xnee_data *xd);
439 
440 int
441 is_first_replayed_event (xnee_data *xd);
442 
443 
444 int
445 xnee_set_first_last (xnee_data *xd);
446 
447 int
448 xnee_unset_first_last (xnee_data *xd);
449 
450 int
451 xnee_get_first_last (xnee_data *xd);
452 
453 int
454 xnee_is_first_last (xnee_data *xd);
455 
456 
457 
458 
459 
460 int
461 xnee_set_no_expose (xnee_data *xd);
462 
463 int
464 xnee_unset_no_expose (xnee_data *xd);
465 
466 int
467 xnee_get_no_expose (xnee_data *xd);
468 
469 int
470 xnee_is_no_expose (xnee_data *xd);
471 
472 
473 int
474 xnee_set_interval (xnee_data *xd, int interval);
475 
476 int
477 xnee_get_interval (xnee_data *xd);
478 
479 
480 int
481 xnee_set_human_printout (xnee_data *xd);
482 
483 int
484 xnee_set_xnee_printout (xnee_data *xd);
485 
486 #define xnee_is_human_printout(xd) (xd->rec_callback == xnee_human_dispatch)
487 #define xnee_is_xnee_printout(xd)  (xd->rec_callback == xnee_record_dispatch)
488 #define xnee_is_autorepeat(xd)     (xd->autorepeat_saved!=0)
489 
490 
491 int
492 xnee_set_replay_speed_str (xnee_data *xd, const char *speed_str);
493 
494 int
495 xnee_set_replay_speed (xnee_data *xd, int speed);
496 
497 int
498 xnee_get_replay_speed(xnee_data *xd);
499 
500 int
501 xnee_set_replay_offset_str (xnee_data *xd, char *str);
502 
503 int
504 xnee_set_replay_offset_x(xnee_data *xd, int offset);
505 
506 int
507 xnee_set_replay_offset_y(xnee_data *xd, int offset);
508 
509 int
510 xnee_get_replay_offset_x(xnee_data *xd);
511 
512 int
513 xnee_get_replay_offset_y(xnee_data *xd);
514 
515 
516 
517 
518 int
519 xnee_set_events_max_str (xnee_data *xd, char *str);
520 
521 int
522 xnee_set_events_max (xnee_data *xd, int loops);
523 
524 int
525 xnee_get_events_max (xnee_data *xd);
526 
527 int
528 xnee_get_events_left (xnee_data *xd);
529 
530 int
531 xnee_set_data_max (xnee_data *xd, int loops);
532 
533 int
534 xnee_get_data_max (xnee_data *xd);
535 
536 int
537 xnee_get_data_left (xnee_data *xd);
538 
539 int
540 xnee_set_time_max (xnee_data *xd, int time);
541 
542 int
543 xnee_get_time_max (xnee_data *xd);
544 
545 int
546 xnee_get_time_left (xnee_data *xd);
547 
548 #define xnee_set_events_recorded(xd,e)  xd->xnee_info.events_recorded=e;
549 #define xnee_get_events_recorded(xd)    xd->xnee_info.events_recorded;
550 #define xnee_inc_events_recorded(xd)    xd->xnee_info.events_recorded++;
551 #define xnee_dec_events_recorded(xd)    xd->xnee_info.events_recorded--;
552 #define xnee_zero_events_recorded(xd)   xd->xnee_info.events_recorded=0;
553 
554 #define xnee_inc_data_recorded(xd)   xd->xnee_info.data_recorded++;
555 #define xnee_dec_data_recorded(xd)   xd->xnee_info.data_recorded--;
556 #define xnee_zero_data_recorded(xd)   xd->xnee_info.data_recorded=0;
557 
558 #define xnee_inc_time_recorded(xd)   xd->xnee_info.time_recorded++;
559 #define xnee_dec_time_recorded(xd)   xd->xnee_info.time_recorded--;
560 #define xnee_zero_time_recorded(xd)   xd->xnee_info.time_recorded=0;
561 
562 int
563 xnee_set_store_mouse_pos(xnee_data *xd);
564 
565 int
566 xnee_unset_store_mouse_pos(xnee_data *xd);
567 
568 Bool
569 xnee_is_store_mouse_pos(xnee_data *xd);
570 
571 int
572 xnee_set_program_name(xnee_data *xd, const char* name);
573 
574 char *
575 xnee_get_program_name(xnee_data *xd);
576 
577 int
578 xnee_get_new_project(xnee_data *xd);
579 
580 int
581 xnee_set_new_project(xnee_data *xd);
582 
583 int
584 xnee_unset_new_project(xnee_data *xd);
585 
586 
587 int
588 xnee_set_autorepeat (xnee_data *xd);
589 
590 int
591 xnee_reset_autorepeat (xnee_data *xd);
592 
593 
594 int
595 xnee_set_application_parameters(xnee_data *xd, char **argv);
596 
597 char **
598 xnee_get_application_parameters(xnee_data *xd);
599 
600 int
601 xnee_set_new_window_pos (xnee_data *xd);
602 
603 int
604 xnee_get_new_window_pos (xnee_data *xd);
605 
606 int
607 xnee_get_new_window_pos_value (xnee_data *xd);
608 
609 int
610 xnee_set_new_window_pos_value (xnee_data *xd, int val);
611 
612 int
613 xnee_unset_new_window_pos (xnee_data *xd);
614 
615 int
616 xnee_get_recall_window_pos (xnee_data *xd);
617 
618 int
619 xnee_set_recall_window_pos (xnee_data *xd);
620 
621 int
622 xnee_unset_recall_window_pos (xnee_data *xd);
623 
624 char *
625 xnee_get_project_name(xnee_data *xd);
626 
627 char *
628 xnee_get_project_descr(xnee_data *xd);
629 
630 char *
631 xnee_get_creat_date(xnee_data *xd);
632 
633 char *
634 xnee_get_creat_program(xnee_data *xd);
635 
636 char *
637 xnee_get_creat_prog_date(xnee_data *xd);
638 
639 char *
640 xnee_get_last_date(xnee_data *xd);
641 
642 char *
643 xnee_get_last_program(xnee_data *xd);
644 
645 char *
646 xnee_get_last_prog_vers(xnee_data *xd);
647 
648 char *
649 xnee_get_author_name(xnee_data *xd);
650 
651 char *
652 xnee_get_author_email(xnee_data *xd);
653 
654 char *
655 xnee_get_char(xnee_data *xd);
656 
657 char *
658 xnee_get_project_name_str(xnee_data *xd);
659 
660 char *
661 xnee_get_project_descr_str(xnee_data *xd);
662 
663 char *
664 xnee_get_creat_date_str(xnee_data *xd);
665 
666 char *
667 xnee_get_creat_prog_vers(xnee_data *xd);
668 
669 char *
670 xnee_get_last_date_str(xnee_data *xd);
671 
672 char *
673 xnee_get_last_prog_str(xnee_data *xd);
674 
675 char *
676 xnee_get_last_prog_date_str(xnee_data *xd);
677 
678 char *
679 xnee_get_author_name_str(xnee_data *xd);
680 
681 char *
682 xnee_get_author_email_str(xnee_data *xd);
683 
684 char *
685 xnee_get_char_str(xnee_data *xd);
686 
687 int
688 xnee_set_all_clients_str(xnee_data *xd, char *str);
689 
690 int
691 xnee_set_future_clients_str(xnee_data *xd, char *str);
692 
693 int
694 xnee_set_future_clients(xnee_data *xd);
695 
696 int
697 xnee_unset_future_clients(xnee_data *xd);
698 
699 int
700 xnee_set_data_max_str (xnee_data *xd, char *str);
701 
702 int
703 xnee_set_time_max_str (xnee_data *xd, char *str);
704 
705 int
706 xnee_set_sync_mode_str (xnee_data *xd, char *str);
707 
708 int
709 xnee_unset_sync_mode_str (xnee_data *xd, char *str);
710 
711 int
712 xnee_set_sync_mode(xnee_data *xd);
713 
714 int
715 xnee_get_sync_mode(xnee_data *xd);
716 
717 
718 int
719 xnee_set_unsync_mode(xnee_data *xd);
720 
721 int
722 xnee_get_unsync_mode(xnee_data *xd);
723 
724 int
725 xnee_unset_sync_mode(xnee_data *xd);
726 
727 int
728 xnee_set_buf_verbose(xnee_data *xd);
729 
730 int
731 xnee_unset_buf_verbose(xnee_data *xd);
732 
733 const char *
734 xnee_get_xosd_font(xnee_data *xd);
735 
736 int
737 xnee_set_xosd_font(xnee_data *xd, char *font_str);
738 
739 int
740 xnee_set_max_threshold_str (xnee_data *xd, char *thresh_str);
741 
742 int
743 xnee_set_min_threshold_str (xnee_data *xd, char *thresh_str);
744 
745 int
746 xnee_set_tot_threshold_str (xnee_data *xd, char *thresh_str);
747 
748 int
749 xnee_set_max_threshold (xnee_data *xd, int thresh);
750 
751 int
752 xnee_set_min_threshold (xnee_data *xd, int thresh);
753 
754 int
755 xnee_set_tot_threshold (xnee_data *xd, int thresh);
756 
757 
758 int
759 xnee_set_rec_resolution_y (xnee_data *xd, int res);
760 
761 int
762 xnee_set_rec_resolution_x (xnee_data *xd, int res);
763 
764 int
765 xnee_set_rep_resolution_y (xnee_data *xd, int res);
766 
767 int
768 xnee_set_rep_resolution_x (xnee_data *xd, int res);
769 
770 
771 
772 int
773 xnee_get_max_threshold (xnee_data *xd);
774 
775 int
776 xnee_get_min_threshold (xnee_data *xd);
777 
778 int
779 xnee_get_tot_threshold (xnee_data *xd);
780 
781 int
782 xnee_set_rec_resolution (xnee_data *xd, char *res_str);
783 
784 int
785 xnee_get_rec_resolution_x (xnee_data *xd);
786 
787 int
788 xnee_get_rec_resolution_y (xnee_data *xd);
789 
790 int
791 xnee_set_rep_resolution (xnee_data *xd, char *res_str);
792 
793 int
794 xnee_get_rep_resolution_x (xnee_data *xd);
795 
796 int
797 xnee_get_rep_resolution_y (xnee_data *xd);
798 
799 #define xnee_set_interrupt_error(xd, err) \
800    (xd->xnee_info.interrupt=err)
801 
802 #define xnee_set_interrupt_action(xd)  \
803    (xd->xnee_info.interrupt=XNEE_OK_LEAVE)
804 
805 #define xnee_unset_interrupt_action(xd) \
806    (xd->xnee_info.interrupt=XNEE_OK)
807 
808 #define xnee_get_interrupt_action(xd) \
809    (xd->xnee_info.interrupt)
810 
811 #define xnee_is_interrupt_action(xd) \
812    (xd->xnee_info.interrupt!=XNEE_OK)
813 
814 xnee_data*
815 xnee_get_xnee_data (void);
816 
817 int
818 xnee_set_xnee_data (xnee_data *xd);
819 
820 int
821 xnee_set_keep_autorepeat (xnee_data *xd);
822 
823 int
824 xnee_set_retype_press_delay(xnee_data *xd, unsigned int delay);
825 
826 int
827 xnee_set_retype_release_delay(xnee_data *xd, unsigned int delay);
828 
829 #define xnee_get_retype_press_delay(xd) \
830   (xd->retype.key_press_delay)
831 
832 #define xnee_get_retype_release_delay(xd) \
833   (xd->retype.key_release_delay)
834 
835 
836 int
837 xnee_set_project_file(xnee_data *xd, char *name);
838 
839 int
840 xnee_set_resolution_str (xnee_data *xd, char *str);
841 
842 int
843 xnee_set_plugin_name(xnee_data *xd, char *str, unsigned char mode);
844 
845 int
846 xnee_set_xosd_feedback(xnee_data *xd);
847 
848 int
849 xnee_set_stderr_feedback(xnee_data *xd);
850 
851 int
852 xnee_set_no_feedback(xnee_data *xd);
853 
854 int
855 xnee_has_xinput2(xnee_data *xd);
856 
857 
858 int
859 xnee_set_no_reparent_recording(xnee_data *xd);
860 
861 int
862 xnee_unset_no_reparent_recording(xnee_data *xd);
863 
864 int
865 xnee_is_no_reparent_recording(xnee_data *xd);
866 
867 
868 int
869 xnee_set_replay_backend(xnee_data *xd, int replay_backend);
870 
871 int
872 xnee_set_replay_backend_name(xnee_data *xd, char *replay_backend);
873 
874 #define xnee_is_swinput_playback(xd) (xd->replay_backend == XNEE_REPLAY_SWINPUT)
875 
876 int
877 xnee_set_forced_core_device_events(xnee_data *xd);
878 
879 int
880 xnee_unset_forced_core_device_events(xnee_data *xd);
881 
882 int
883 xnee_is_forced_core_device_events(xnee_data *xd);
884 
885 int
886 xnee_get_max_nr_of_moves(xnee_data *xd);
887 
888 int
889 xnee_set_max_nr_of_moves(xnee_data *xd, int moves);
890 
891 int
892 xnee_set_override_display(xnee_data *xd, int mode);
893 
894 int
895 xnee_get_override_display(xnee_data *xd);
896 
897 #endif /* XNEE_SETGET_H */
898