1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
/* Xoo - a graphical wrapper around xnest
*
* Copyright 2004,2005 Matthew Allum, Openedhand Ltd <mallum@o-hand.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _FAKEDEV_H
#define _FAKEDEV_H
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <gtk/gtk.h>
#include <X11/extensions/XTest.h>
#include "config.h"
typedef struct FakeApp FakeApp;
typedef struct FakeButton FakeButton;
struct FakeApp
{
GtkWidget *window;
GtkWidget *menubar;
GtkWidget *fixed;
GtkWidget *back;
GtkWidget *winnest;
GtkWidget *popupmenu;
GtkWidget *debug_menu;
GtkWidget *prefs_window;
GtkWidget *entry_display, *entry_server, *entry_options, *entry_start;
int device_width;
int device_height;
int device_display_x;
int device_display_y;
int device_display_width;
int device_display_height;
GdkPixbuf *device_img;
/* Button stuff */
FakeButton *button_head; /* TODO: GList */
struct timeval key_rep_init_timeout;
struct timeval key_rep_timeout;
/* Xnest */
Display *xnest_dpy;
Window xnest_window;
char *xnest_dpy_name;
char *xnest_bin_path;
char *xnest_bin_options;
pid_t xnest_pid;
char *win_title;
char *start_cmd;
int argc;
char **argv;
};
struct FakeButton
{
FakeApp *app;
GtkWidget *image;
int x, y;
int width, height;
KeySym keysym;
GdkPixbuf *overlay;
cairo_surface_t *normal_img, *active_img;
int repeat;
FakeButton *next;
};
int config_init (FakeApp * app, char *conf_file);
/* buttons */
FakeButton *button_new (FakeApp * app, int x, int y, int width, int height,
KeySym ks, int reepreat, GdkPixbuf * img);
FakeButton *button_find_from_win (FakeApp * app, Window xevent_window_id);
void
button_press (GtkWidget * w, GdkEventButton * event, FakeButton * button);
void
button_release (GtkWidget * w, GdkEventButton * event, FakeButton * button);
void button_activate (FakeApp * app, FakeButton * button);
/* keys */
#define KEYDOWN 1
#define KEYUP 2
#define KEYUPDOWN 3
int keys_init (FakeApp * app);
void keys_send_key (FakeApp * app, KeySym ks, int key_direction);
#endif /* _FAKEDEV_H */
|