-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
92 lines (73 loc) · 1.28 KB
/
main.c
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
#include "mywin.h"
main()
{
int a;
int b;
int x,y;
int xo,yo;
int ok,oko;
int tmpy;
int tmpy1;
int need;
struct my_win *bt;
struct my_obj *obj;
struct my_obj *obj1;
my_init();
bt=my_create_win(0,0,400,200,WIN_TITLE|WIN_CLOSE|WIN_ICON,"my Win");
my_create_button(bt,10,10, 50,20,2,1,"test1" );
my_create_button(bt,10,43, 50,20,3,2,"test2" );
my_create_button(bt,10,76, 50,20,3,3,"test3" );
obj=my_create_button(bt,10,109, 50,30,3,4,"test4" );
create_slide(bt,275,30,100,VERT);
create_slide(bt,70,10,200,0);
focus=bt;
obj1=0;
oko=X11_locator(&xo,&yo) & 1;
update_all(bt);
my_draw_separatory(80,50,80);
my_draw_separator(80,50,80);
my_draw_separatory(160,50,80);
my_draw_separator(120,130,40);
while(1 )
{
here:
ok=X11_locator(&x,&y) & 1;
if((ok == oko) && (x == xo) && (y == yo) &&(need==0) ) goto here;
{
obj=obj1;
obj1=find_obj(x,y);
printf("%s: %x \n",__FUNCTION__,obj1);
if(obj1 )
{
if((obj1->type == WIN_BUTTON) )
{
if(obj1 != 0)
{
if(ok==1)
{
(obj1->change)(obj1,WIN_FOCUS);
need=1;
}
else {
(obj1->change)(obj1,WIN_LOOSF);
need=0;
}
}
goto here2;
}
if( ( obj1->type == WIN_SLIDE))
{
if(obj1 != 0)
{
(obj1->change)(obj1,WIN_FOCUS);
need=obj1->needupdate;
}
}
}
}
here2:
oko=ok;
xo=x; yo=y;
}
sleep(60);
}