1 /* WMGlobe 0.5 - All the Earth on a WMaker Icon
2 * copyright (C) 1998,99 Jerome Dumonteil <jerome.dumonteil@capway.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 ***************************************************************************/
19 * I used many functions of wmgeneral.c ("openXwindow")
20 * for the main function of wmglobe.c
21 * wmgeneral.c was taken from wmaker applet wmtune-1.0 :
22 * Author: Martijn Pieterse (pieterse@xs4all.nl)
24 * wmglobe.c uses functions of : Xglobe, Xearth, wmgeneral, wmaker/wrlib
25 ***************************************************************************/
32 #include "scrtime.xpm"
35 static void move_earth(double vla
, double vlo
);
36 static int flush_expose(Window w
);
37 static void mqparam();
38 static double getdegre(char *val
);
39 static void screen_1();
40 static void screen_2();
41 static void screen_3();
42 static void screen_4();
43 static void screen_5();
44 static void screen_6();
45 static void screen_7();
46 static void write_icon(char *txt
, int x
, int y
);
47 static void chiffre(int ch
, int xx
, int yy
);
48 static int lettre(char c
, int xx
, int yy
);
49 static void display_pos(double la
, double lo
);
50 static void display_date(double la
, double lo
);
51 static void release_but(int ckm
);
52 static void press_but(int ckm
);
53 static void display_zoom();
54 static void display_light();
55 static void display_accel();
56 static void display_dlat();
57 static void display_type();
58 static void move_delay(int factor
);
59 static void move_zoom(int factor
);
60 static void move_light(int factor
);
61 static void move_dawn(int factor
);
62 static void move_accel(int factor
);
63 static void move_dlat(int factor
);
64 static void move_dlong(int factor
);
65 /* ------------------------------------------------------------------------ */
69 /* ------------------------------------------------------------------------ */
70 struct timeval
diftimev(struct timeval t1
, struct timeval t2
)
72 t1
.tv_usec
-= t2
.tv_usec
;
74 t1
.tv_usec
+= 1000000;
77 t1
.tv_sec
-= t2
.tv_sec
;
80 /* ------------------------------------------------------------------------ */
81 struct timeval
addtimev(struct timeval t1
, struct timeval t2
)
83 t1
.tv_usec
+= t2
.tv_usec
;
84 if (t1
.tv_usec
>= 1000000) {
85 t1
.tv_usec
-= 1000000;
88 t1
.tv_sec
+= t2
.tv_sec
;
91 /* ------------------------------------------------------------------------ */
92 struct timeval
getimev()
97 gettimeofday(&tv
, &tz
);
100 /* ------------------------------------------------------------------------ */
104 * defaults, commandline
105 * init of pixmap for screenpos and numbers displaying
107 /* ------------------------------------------------------------------------ */
108 void loadxpm(Window draw
)
110 XpmCreatePixmapFromData(dpy
, draw
, scrpos_xpm
, &(screenpos
.pixmap
),
111 &(screenpos
.mask
), &(screenpos
.attributes
));
112 XpmCreatePixmapFromData(dpy
, draw
, scrtime_xpm
, &(scrdate
.pixmap
),
113 &(scrdate
.mask
), &(scrdate
.attributes
));
114 XpmCreatePixmapFromData(dpy
, draw
, zapnum_xpm
, &(numpix
.pixmap
),
115 &(numpix
.mask
), &(numpix
.attributes
));
116 XpmCreatePixmapFromData(dpy
, draw
, zaptxt_xpm
, &(txtpix
.pixmap
),
117 &(txtpix
.mask
), &(txtpix
.attributes
));
118 XpmCreatePixmapFromData(dpy
, draw
, scrdiv_xpm
, &(scrdiv
.pixmap
),
119 &(scrdiv
.mask
), &(scrdiv
.attributes
));
122 /* ------------------------------------------------------------------------ */
127 use_nightmap
= FALSE
;
129 oknimap
= DEFAULT_NIGHTMAP
;
131 delay
= DEFAULT_DELAY
;
139 v_lat
= DEFAULT_V_LAT
/ 180. * PI
;
140 v_long
= DEFAULT_V_LONG
/ 180. * PI
;
141 dv_lat
= DEFAULT_V_LAT
;
142 dv_long
= DEFAULT_V_LONG
;
143 old_dvlat
= DEFAULT_V_LAT
;
144 old_dvlong
= DEFAULT_V_LONG
;
153 fov
= 0.5 * PI
/ 180.;
156 ambient_light
= DEFAULT_LIGHT
;
158 typecadre
= DEFAULT_BORDER
;
164 option_iw
= WithdrawnState
;
167 proj_dist
= DIAMETRE
/ tan(fov
);
173 md
[0] = (MPO
*) malloc(sizeof(MPO
));
174 md
[1] = (MPO
*) malloc(sizeof(MPO
));
175 md
[2] = (MPO
*) malloc(sizeof(MPO
));
176 md
[3] = (MPO
*) malloc(sizeof(MPO
));
177 mn
[0] = (MPO
*) malloc(sizeof(MPO
));
178 mn
[1] = (MPO
*) malloc(sizeof(MPO
));
179 mn
[2] = (MPO
*) malloc(sizeof(MPO
));
180 mn
[3] = (MPO
*) malloc(sizeof(MPO
));
186 /* ------------------------------------------------------------------------ */
187 static double getdegre(char *val
)
190 if (strchr(val
, '°') != NULL
|| strchr(val
, 'd') != NULL
191 || strchr(val
, 'D') != NULL
|| strchr(val
, ':') != NULL
) {
193 sscanf(val
, "%lf%*c%lf%*c%lf", &d
, &m
, &s
);
195 return d
+ m
/ 60. + s
/ 3600.;
197 return d
- m
/ 60. - s
/ 3600.;
202 /* ------------------------------------------------------------------------ */
203 static void mqparam()
205 printf("error in parameters\n");
209 /* ------------------------------------------------------------------------ */
210 void cmdline(int argc
, char *argv
[])
215 for (i
= 1; i
< argc
; i
++) {
218 /* ---------------------------------------------------- */
219 if (strcasecmp(argv
[i
], "-v") == 0
220 || strcasecmp(argv
[i
], "-version") == 0) {
221 printf("%s\n", WMGVERSION
);
224 /* ---------------------------------------------------- */
225 if (strcasecmp(argv
[i
], "-w") == 0
226 || strcasecmp(argv
[i
], "-wmaker") == 0) {
227 option_iw
= WithdrawnState
;
230 /* ---------------------------------------------------- */
231 if (strcasecmp(argv
[i
], "-i") == 0
232 || strcasecmp(argv
[i
], "-iconic") == 0) {
233 option_iw
= IconicState
;
236 /* ---------------------------------------------------- */
237 if (!j
&& (strcasecmp(argv
[i
], "-s") == 0 ||
238 strcasecmp(argv
[i
], "-shape") == 0)) {
242 /* ---------------------------------------------------- */
243 if (!j
&& (strcasecmp(argv
[i
], "-d") == 0
244 || strcasecmp(argv
[i
], "-display") == 0)) {
254 /* ---------------------------------------------------- */
255 if (!j
&& (strcasecmp(argv
[i
], "-rand") == 0
256 || strcasecmp(argv
[i
], "-random") == 0)) {
258 srandom(((int) time(NULL
)) + ((int) getpid()));
261 /* ---------------------------------------------------- */
262 if (!j
&& (strcasecmp(argv
[i
], "-oz") == 0
263 || strcasecmp(argv
[i
], "-austral") == 0)) {
267 /* ---------------------------------------------------- */
268 if (!j
&& strcasecmp(argv
[i
], "-map") == 0) {
274 if ((dayfile
= (char *) malloc(strlen(argv
[i
]) + 1)) == NULL
) {
275 fprintf(stderr
, "erreur memoire options map\n");
278 strcpy(dayfile
, argv
[i
]);
284 /* ---------------------------------------------------- */
285 if (!j
&& (strcasecmp(argv
[i
], "-nimap") == 0
286 || strcasecmp(argv
[i
], "-nightmap") == 0
287 || strcasecmp(argv
[i
], "-night") == 0)) {
293 if ((nightfile
= (char *) malloc(strlen(argv
[i
]) + 1)) == NULL
) {
294 fprintf(stderr
, "erreur memoire options nimap\n");
297 strcpy(nightfile
, argv
[i
]);
304 /* ---------------------------------------------------- */
305 if (!j
&& (strcasecmp(argv
[i
], "-accel") == 0
306 || strcasecmp(argv
[i
], "-accell") == 0
307 || strcasecmp(argv
[i
], "-acc") == 0
308 || strcasecmp(argv
[i
], "-multi") == 0)) {
312 time_multi
= atof(argv
[i
]);
313 if (time_multi
< 1.0)
315 if (time_multi
> MAX_MULTI_COEF
)
316 time_multi
= MAX_MULTI_COEF
;
317 if (time_multi
> 24.0)
318 time_multi
= floor(time_multi
);
320 time_multi
= floor(time_multi
* 10.0) / 10.0;
326 /* ---------------------------------------------------- */
327 if (!j
&& (strcasecmp(argv
[i
], "-nonimap") == 0
328 || strcasecmp(argv
[i
], "-nonightmap") == 0
329 || strcasecmp(argv
[i
], "-nonight") == 0
330 || strcasecmp(argv
[i
], "-nomap") == 0)) {
332 use_nightmap
= FALSE
;
335 /* ---------------------------------------------------- */
336 if (!j
&& strcasecmp(argv
[i
], "-zoom") == 0) {
340 zoom
= atof(argv
[i
]);
350 /* ---------------------------------------------------- */
351 if (!j
&& strcasecmp(argv
[i
], "-dawn") == 0) {
355 dawn
= atof(argv
[i
]);
356 dawn
= MAX(0.0, dawn
);
357 dawn
= MIN(1.0, dawn
);
359 dawn
= (1.0 - dawn
/ 2.0);
365 /* ---------------------------------------------------- */
366 if (!j
&& strcasecmp(argv
[i
], "-delay") == 0) {
370 delay
= atof(argv
[i
]);
373 if (delay
> MAX_DELAY_SEC
)
374 delay
= MAX_DELAY_SEC
;
380 /* ---------------------------------------------------- */
381 if (!j
&& (strcasecmp(argv
[i
], "-dlat") == 0
382 || strcasecmp(argv
[i
], "-lat") == 0
383 || strcasecmp(argv
[i
], "-dlatitude") == 0)) {
387 dlat
= getdegre(argv
[i
]);
388 if (dlat
< -MAX_DELTA_LONG
)
389 dlat
= -MAX_DELTA_LONG
;
390 if (dlat
> MAX_DELTA_LONG
)
391 dlat
= MAX_DELTA_LONG
;
398 /* ---------------------------------------------------- */
399 if (!j
&& (strcasecmp(argv
[i
], "-dlong") == 0
400 || strcasecmp(argv
[i
], "-long") == 0
401 || strcasecmp(argv
[i
], "-dlongitude") == 0)) {
405 dlong
= getdegre(argv
[i
]);
406 if (dlong
< -MAX_DELTA_LONG
)
407 dlong
= -MAX_DELTA_LONG
;
408 if (dlong
> MAX_DELTA_LONG
)
409 dlong
= MAX_DELTA_LONG
;
416 /* ---------------------------------------------------- */
417 if (!j
&& strcasecmp(argv
[i
], "-light") == 0) {
421 ambient_light
= atof(argv
[i
]);
422 if (ambient_light
< 0.)
424 if (ambient_light
> 1.)
431 /* ---------------------------------------------------- */
432 if (!j
&& strcasecmp(argv
[i
], "-time") == 0) {
436 tbase
.tv_sec
= atoi(argv
[i
]);
443 /* ---------------------------------------------------- */
444 if (!j
&& (strcasecmp(argv
[i
], "-bord") == 0
445 || strcasecmp(argv
[i
], "-border") == 0)) {
449 typecadre
= atoi(argv
[i
]);
459 /* ---------------------------------------------------- */
460 if (!j
&& strcasecmp(argv
[i
], "-fun") == 0) {
464 funx
= atoi(argv
[i
]);
469 funy
= atoi(argv
[i
]);
479 /* ---------------------------------------------------- */
480 if (!j
&& (strcasecmp(argv
[i
], "-pos") == 0
481 || strcasecmp(argv
[i
], "-position") == 0
482 || strcasecmp(argv
[i
], "-fixed") == 0)) {
486 addlat
= getdegre(argv
[i
]);
490 addlong
= getdegre(argv
[i
]);
500 /* ---------------------------------------------------- */
502 if (!j
&& argv
[i
][0] == '-') {
503 printf("%s\n", WMGVERSION
);
505 printf("-v : version -h : this help message !\n");
506 printf("-zoom zoom_value : changing apparent size in icon\n");
507 printf("-pos latitude long. : fixed initial position (default=follow sun)\n");
508 printf("-rand : random position at every refresh\n");
509 printf("-map map_file : use this map for rendering\n");
510 printf("-nimap night_file : and this one for the dark side of earth\n");
511 printf("-nonimap : don't use the default night map\n");
512 printf("-delay seconds : time between refresh of image\n");
513 printf("-dlat delta_lat : latitude speed of point of view (default=follow sun)\n");
514 printf("-dlong delta_long : the same for longitude\n");
515 printf("-light light_value : level of light for dark side of earth\n");
516 printf("-dawn dawn_value : level of continuity for dawn limit\n");
517 printf("-bord border_num : 0 1 or 2 , type of icon border.\n");
518 printf("-accel time_multi : time accelerator\n");
519 printf("-time seconds : time to display in seconds since 01-01-1970\n");
520 printf("-oz : start in \"austral\" mode (for \"down under\" people)\n");
521 printf("-fun dx dy : offset of vision... almost useless\n");
522 printf("-w -shape : set by default (WMaker dockable application)\n");
523 printf("-d display : display (WindowMaker not needed on the server side)\n");
524 printf("left button : change longitude, with shift key, change latitude too\n");
525 printf("middle button : zoom in, shift + middle button : zoom out\n");
526 printf("right button : access to a few screens of parameters\n");
529 /* ------------------------------------------------------------------------ */
535 /****************************************************************************
536 * X functions, mouse selection
540 /* ------------------------------------------------------------------------ */
541 static int flush_expose(Window w
)
546 while (XCheckTypedWindowEvent(dpy
, w
, Expose
, &dummy
))
550 /* ------------------------------------------------------------------------ */
551 void RedrawWindowXYWH(int x
, int y
, int w
, int h
)
553 flush_expose(iconwin
);
554 XCopyArea(dpy
, wmg
.pixmap
, iconwin
, NormalGC
, x
, y
, w
, h
, x
, y
);
556 XCopyArea(dpy
, wmg
.pixmap
, win
, NormalGC
, x
, y
, w
, h
, x
, y
);
559 /* ------------------------------------------------------------------------ */
560 void AddMouseRegion(int index
, int left
, int top
, int right
, int bottom
)
562 if (index
< MAX_MOUSE_REGION
) {
563 mouse_region
[index
].enable
= 1;
564 mouse_region
[index
].top
= top
;
565 mouse_region
[index
].left
= left
;
566 mouse_region
[index
].bottom
= bottom
;
567 mouse_region
[index
].right
= right
;
571 /* ------------------------------------------------------------------------ */
572 int CheckMouseRegion(int x
, int y
)
579 for (i
= 0; i
< MAX_MOUSE_REGION
&& !found
; i
++) {
580 if (mouse_region
[i
].enable
&&
581 x
<= mouse_region
[i
].right
&&
582 x
>= mouse_region
[i
].left
&&
583 y
<= mouse_region
[i
].bottom
&&
584 y
>= mouse_region
[i
].top
)
591 /* ------------------------------------------------------------------------ */
593 * GRAPHIC : pixmap writing of letters & numbers
596 /* ------------------------------------------------------------------------ */
597 static void chiffre(int ch
, int xx
, int yy
)
599 XCopyArea(dpy
, numpix
.pixmap
, wmg
.pixmap
, NormalGC
,
600 zapnum
[ch
][0], zapnum
[ch
][1], zapnum
[ch
][2], zapnum
[ch
][3], xx
, yy
);
604 /* ------------------------------------------------------------------------ */
605 static int lettre(char c
, int xx
, int yy
)
611 switch (toupper(c
)) {
815 XCopyArea(dpy
, txtpix
.pixmap
, wmg
.pixmap
, NormalGC
,
816 i
, 0, 6, 10, xx
, yy
);
819 /* ------------------------------------------------------------------------ */
820 static void write_icon(char *txt
, int x
, int y
)
826 fprintf(stdout
, "%s_\n", txt
);
830 if (txt
[p
] == '\0' || x
> DIAMETRE
- 5) {
833 x
= lettre(txt
[p
], x
, y
);
839 /* ------------------------------------------------------------------------ */
840 static void press_but(int ckm
)
844 XCopyArea(dpy
, scrdiv
.pixmap
, wmg
.pixmap
, NormalGC
,
845 0, 38, 20, 9, 2, 52);
846 RedrawWindowXYWH(2, 52, 20, 9);
849 XCopyArea(dpy
, scrdiv
.pixmap
, wmg
.pixmap
, NormalGC
,
850 20, 38, 20, 9, 22, 52);
851 RedrawWindowXYWH(22, 52, 20, 9);
854 XCopyArea(dpy
, scrdiv
.pixmap
, wmg
.pixmap
, NormalGC
,
855 40, 38, 20, 9, 42, 52);
856 RedrawWindowXYWH(42, 52, 20, 9);
863 /* ------------------------------------------------------------------------ */
864 static void release_but(int ckm
)
868 XCopyArea(dpy
, scrdiv
.pixmap
, wmg
.pixmap
, NormalGC
,
869 0, 28, 20, 9, 2, 52);
870 RedrawWindowXYWH(2, 52, 20, 9);
873 XCopyArea(dpy
, scrdiv
.pixmap
, wmg
.pixmap
, NormalGC
,
874 20, 28, 20, 9, 22, 52);
875 RedrawWindowXYWH(22, 52, 20, 9);
878 XCopyArea(dpy
, scrdiv
.pixmap
, wmg
.pixmap
, NormalGC
,
879 40, 28, 20, 9, 42, 52);
880 RedrawWindowXYWH(42, 52, 20, 9);
887 /* ------------------------------------------------------------------------ */
889 * MENU SELECTION & ACTIONS
891 /* ------------------------------------------------------------------------ */
894 AddMouseRegion(0, 0, 0, 0, 0);
895 if (p_type
== PTRANDOM
) {
896 stoprand
= STOP_RANDOM_FACTOR
;
901 while (gotoscr
!= 0) {
930 * put old environment
932 XShapeCombineMask(dpy
, win
, ShapeBounding
, 0, 0, pixmask
, ShapeSet
);
933 XShapeCombineMask(dpy
, iconwin
, ShapeBounding
, 0, 0, pixmask
, ShapeSet
);
935 AddMouseRegion(0, 5, 5, DIAMETRE
- 4, DIAMETRE
- 4);
941 /* ------------------------------------------------------------------------ */
942 static void display_pos(double la
, double lo
)
944 int c
, i
, j
, k
, l
, neg
;
952 i
= floor(la
/ 10.0);
957 k
= floor(la
/ 10.0);
965 chiffre(neg
, platd
[1][0], platd
[1][1]);
966 chiffre(i
, platd
[2][0], platd
[2][1]);
967 chiffre(j
, platd
[3][0], platd
[3][1]);
968 chiffre(k
, platm
[0][0], platd
[0][1]);
969 chiffre(l
, platm
[1][0], platd
[1][1]);
977 c
= floor(lo
/ 100.0);
990 i
= floor(lo
/ 10.0);
995 k
= floor(lo
/ 10.0);
998 if (i
== 0 && c
> 9) {
1002 chiffre(neg
, plongd
[0][0], plongd
[0][1]);
1003 chiffre(c
, plongd
[1][0], plongd
[1][1]);
1004 chiffre(i
, plongd
[2][0], plongd
[2][1]);
1005 chiffre(j
, plongd
[3][0], plongd
[3][1]);
1006 chiffre(k
, plongm
[0][0], plongm
[0][1]);
1007 chiffre(l
, plongm
[1][0], plongm
[1][1]);
1009 RedrawWindowXYWH(0, 0, DIAMETRE
, DIAMETRE
);
1012 /* ------------------------------------------------------------------------ */
1013 void rotation_terre(int x
, int y
, int lat_flag
)
1016 * earth rotate after (while) a clic
1019 mx
= (double) ((double) x
- DIAMETRE
/ 2 + 0.5) / zoom
* cos(v_lat
) * sens
;
1021 my
= -(double) ((double) y
- DIAMETRE
/ 2 + 0.5) * sens
/ zoom
;
1023 my
+= ABS(sin(v_lat
) * ((double) x
- DIAMETRE
/ 2 + 0.5) / zoom
);
1025 my
-= ABS(sin(v_lat
) * ((double) x
- DIAMETRE
/ 2 + 0.5) / zoom
);
1029 if (p_type
== PTRANDOM
) {
1030 stoprand
= STOP_RANDOM_FACTOR
;
1034 addlong
+= mx
* RATIO_ROTATE
;
1035 addlat
+= my
* RATIO_ROTATE
;
1037 do_something
= TRUE
;
1040 /* ------------------------------------------------------------------------ */
1041 static void move_earth(double vla
, double vlo
)
1049 setViewPos(sun_lat
* 180. / PI
+ addlat
,
1050 sun_long
* 180. / PI
+ addlong
);
1055 setViewPos(addlat
, addlong
);
1060 display_pos(dv_lat
, dv_long
);
1063 /* ------------------------------------------------------------------------ */
1064 static void screen_1()
1066 int ok
, ckm
, sensadd
, waitrel
, not3
;
1070 fprintf(stdout
, "scr 1\n");
1078 XShapeCombineMask(dpy
, win
, ShapeBounding
, 0, 0, screenpos
.mask
, ShapeSet
);
1079 XShapeCombineMask(dpy
, iconwin
, ShapeBounding
, 0, 0, screenpos
.mask
, ShapeSet
);
1081 XCopyArea(dpy
, screenpos
.pixmap
, wmg
.pixmap
, NormalGC
, 0, 0, DIAMETRE
, DIAMETRE
, 0, 0);
1083 AddMouseRegion(1, platd
[0][0], platd
[0][1], platd
[3][0] + 9, platd
[3][1] + 12);
1084 AddMouseRegion(2, platm
[0][0], platm
[0][1], platm
[1][0] + 9, platm
[1][1] + 12);
1085 AddMouseRegion(3, plongd
[0][0], plongd
[0][1], plongd
[3][0] + 9, plongd
[3][1] + 12);
1086 AddMouseRegion(4, plongm
[0][0], plongm
[0][1], plongm
[1][0] + 9, plongm
[1][1] + 12);
1087 AddMouseRegion(5, 1, 51, 21, 61);
1088 AddMouseRegion(6, 22, 51, 41, 61);
1089 AddMouseRegion(7, 42, 51, 62, 61);
1091 display_pos(dv_lat
, dv_long
);
1095 while (XPending(dpy
)) {
1096 XNextEvent(dpy
, &Event
);
1097 switch (Event
.type
) {
1099 RedrawWindowXYWH(0, 0, DIAMETRE
, DIAMETRE
);
1106 ckm
= CheckMouseRegion(Event
.xbutton
.x
, Event
.xbutton
.y
);
1109 switch (Event
.xbutton
.button
) {
1129 ckm
= CheckMouseRegion(Event
.xbutton
.x
, Event
.xbutton
.y
);
1130 if (waitrel
== ckm
) {
1135 gotoscr
= NUM_SCREEN
;
1139 if (gotoscr
> NUM_SCREEN
)
1157 usleep(VAL_USLEEP_SHORT
);
1158 if (waitrel
&& not3
) {
1160 move_earth(sens
* sensadd
* 1.0, 0.0);
1164 move_earth(sens
* sensadd
* 1.0 / 60.0, 0.0);
1168 move_earth(0.0, sens
* sensadd
* 1.0);
1172 move_earth(0.0, sens
* sensadd
* 1.0 / 60.0);
1176 if (waitrel
== 0 && diftimev(getimev(), tin
).tv_sec
> SCREEN_WAIT
&& gotoscr
== 1)
1183 /* ------------------------------------------------------------------------ */
1184 static void display_date(double la
, double lo
)
1190 write_icon(" time :", 2, 2);
1191 RedrawWindowXYWH(2, 2, DIAMETRE
- 1, DIAMETRE
- 1);
1193 write_icon(" GMT+long.", 2, 14);
1194 RedrawWindowXYWH(2, 14, DIAMETRE
- 1, DIAMETRE
- 1);
1197 t
+= (int) (floor((lo
+ 7.5) / 15.0) * 3600);
1198 /*** pb near 2038 ***/
1200 strftime(datest
, 30, "%x", gmtime(&t
));
1202 i
= 10 - strlen(datest
);
1208 write_icon(datest
, 2 + i
* 6, 26);
1209 RedrawWindowXYWH(2, 26, DIAMETRE
- 1, DIAMETRE
- 1);
1211 strftime(datest
, 30, "%X", gmtime(&t
));
1213 i
= 10 - strlen(datest
);
1216 while (datest
[i
] != '\0') {
1217 if (datest
[i
] != ' ') {
1222 datest
[j
] = datest
[j
+ 1];
1225 while (datest
[j
- 1] != '\0');
1233 write_icon(datest
, 2 + i
* 6, 38);
1234 RedrawWindowXYWH(2, 38, DIAMETRE
- 1, DIAMETRE
- 1);
1238 /* ------------------------------------------------------------------------ */
1239 static void screen_2()
1241 int ok
, ckm
, waitrel
;
1245 fprintf(stdout
, "scr 2\n");
1251 XShapeCombineMask(dpy
, win
, ShapeBounding
, 0, 0, scrdate
.mask
, ShapeSet
);
1252 XShapeCombineMask(dpy
, iconwin
, ShapeBounding
, 0, 0, scrdate
.mask
, ShapeSet
);
1254 XCopyArea(dpy
, scrdate
.pixmap
, wmg
.pixmap
, NormalGC
, 0, 0, DIAMETRE
, DIAMETRE
, 0, 0);
1256 display_date(dv_lat
, dv_long
);
1260 while (XPending(dpy
)) {
1261 XNextEvent(dpy
, &Event
);
1262 switch (Event
.type
) {
1264 RedrawWindowXYWH(0, 0, DIAMETRE
, DIAMETRE
);
1271 ckm
= CheckMouseRegion(Event
.xbutton
.x
, Event
.xbutton
.y
);
1274 switch (Event
.xbutton
.button
) {
1290 ckm
= CheckMouseRegion(Event
.xbutton
.x
, Event
.xbutton
.y
);
1291 if (waitrel
== ckm
) {
1296 gotoscr
= NUM_SCREEN
;
1300 if (gotoscr
> NUM_SCREEN
)
1318 usleep(VAL_USLEEP_SHORT
);
1320 if (waitrel
== 0 && diftimev(getimev(), tin
).tv_sec
> SCREEN_WAIT
&& gotoscr
== 2)
1327 /* ------------------------------------------------------------------------ */
1328 static void display_zoom()
1330 char datest
[32], dstr
[32];
1333 write_icon(" delay :", 2, 2);
1334 RedrawWindowXYWH(2, 2, DIAMETRE
- 1, DIAMETRE
- 1);
1336 sprintf(dstr
, "%f", delay
);
1338 i
= strlen(dstr
) - 1;
1340 if (dstr
[i
] == '0') {
1347 i
= strlen(dstr
) - 1;
1350 sprintf(datest
, "%s s", dstr
);
1352 i
= 10 - strlen(datest
);
1357 write_icon(datest
, 2 + i
* 6, 14);
1358 RedrawWindowXYWH(2, 14, DIAMETRE
- 1, DIAMETRE
- 1);
1360 write_icon(" zoom :", 2, 26);
1361 RedrawWindowXYWH(2, 26, DIAMETRE
- 1, DIAMETRE
- 1);
1363 sprintf(datest
, "%.3f", zoom
);
1364 i
= 10 - strlen(datest
);
1369 write_icon(datest
, 2 + i
* 6, 38);
1370 RedrawWindowXYWH(2, 38, DIAMETRE
- 1, DIAMETRE
- 1);
1374 /* ------------------------------------------------------------------------ */
1375 static void move_delay(int factor
)
1378 if (delay
< (double) VAL_USLEEP
/ 1000000)
1379 delay
= (double) VAL_USLEEP
/ 1000000;
1380 else if (delay
< 0.1) {
1384 } else if (delay
< 1.) {
1388 } else if (delay
< 60.)
1390 else if (delay
< 300.)
1392 else if (delay
< 3600.)
1394 else if (delay
< MAX_DELAY_SEC
)
1397 if (delay
> MAX_DELAY_SEC
)
1398 delay
= MAX_DELAY_SEC
;
1402 else if (delay
> 300.)
1404 else if (delay
> 60.)
1406 else if (delay
> 1.)
1408 else if (delay
> 0.1)
1410 else if (delay
> (double) VAL_USLEEP
/ 1000000)
1415 if (delay
< (double) VAL_USLEEP
/ 1000000)
1419 tdelay
.tv_sec
= (int) floor(delay
);
1420 tdelay
.tv_usec
= (int) ((delay
- tdelay
.tv_sec
) * 1000000);
1422 XCopyArea(dpy
, scrdiv
.pixmap
, wmg
.pixmap
, NormalGC
,
1423 0, 15, 60, 10, 2, 14);
1428 /* ------------------------------------------------------------------------ */
1429 void zooming(int facto
)
1432 zoom
/= ZOOM_FACTOR
;
1434 zoom
*= ZOOM_FACTOR
;
1435 zoom
= MAX(zoom
, ZOOM_MIN
);
1436 zoom
= MIN(zoom
, ZOOM_MAX
);
1437 if (p_type
== PTRANDOM
) {
1440 stoprand
= STOP_RANDOM_FACTOR
;
1443 do_something
= TRUE
;
1446 /* ------------------------------------------------------------------------ */
1447 static void move_zoom(int factor
)
1453 XCopyArea(dpy
, scrdiv
.pixmap
, wmg
.pixmap
, NormalGC
,
1454 0, 15, 60, 10, 2, 38);
1458 /* ------------------------------------------------------------------------ */
1459 static void screen_3()
1461 int ok
, ckm
, waitrel
, sensadd
, not3
;
1465 fprintf(stdout
, "scr 3\n");
1472 XShapeCombineMask(dpy
, win
, ShapeBounding
, 0, 0, scrdate
.mask
, ShapeSet
);
1473 XShapeCombineMask(dpy
, iconwin
, ShapeBounding
, 0, 0, scrdate
.mask
, ShapeSet
);
1475 XCopyArea(dpy
, scrdate
.pixmap
, wmg
.pixmap
, NormalGC
, 0, 0, DIAMETRE
, DIAMETRE
, 0, 0);
1477 AddMouseRegion(1, 2, 14, DIAMETRE
- 2, 25);
1478 AddMouseRegion(2, 2, 38, DIAMETRE
- 2, 49);
1484 while (XPending(dpy
)) {
1485 XNextEvent(dpy
, &Event
);
1486 switch (Event
.type
) {
1488 RedrawWindowXYWH(0, 0, DIAMETRE
, DIAMETRE
);
1495 ckm
= CheckMouseRegion(Event
.xbutton
.x
, Event
.xbutton
.y
);
1498 switch (Event
.xbutton
.button
) {
1519 ckm
= CheckMouseRegion(Event
.xbutton
.x
, Event
.xbutton
.y
);
1520 if (waitrel
== ckm
) {
1525 gotoscr
= NUM_SCREEN
;
1529 if (gotoscr
> NUM_SCREEN
)
1547 usleep(VAL_USLEEP_SHORT
);
1548 if (waitrel
&& not3
) {
1550 move_delay(sensadd
);
1551 usleep(2 * VAL_USLEEP
);
1558 if (waitrel
== 0 && diftimev(getimev(), tin
).tv_sec
> SCREEN_WAIT
&& gotoscr
== 3)
1565 /* ------------------------------------------------------------------------ */
1566 static void display_light()
1571 write_icon(" light :", 2, 2);
1572 RedrawWindowXYWH(2, 2, DIAMETRE
- 1, DIAMETRE
- 1);
1574 sprintf(datest
, "%.2f", ambient_light
);
1575 i
= 10 - strlen(datest
);
1580 write_icon(datest
, 2 + i
* 6, 14);
1581 RedrawWindowXYWH(2, 14, DIAMETRE
- 1, DIAMETRE
- 1);
1583 write_icon(" dawn :", 2, 26);
1584 RedrawWindowXYWH(2, 26, DIAMETRE
- 1, DIAMETRE
- 1);
1586 dawn
= (1.0 - dawn
) * 2.0;
1587 sprintf(datest
, "%.2f", dawn
);
1588 dawn
= (1.0 - dawn
/ 2.0);
1589 i
= 10 - strlen(datest
);
1594 write_icon(datest
, 2 + i
* 6, 38);
1595 RedrawWindowXYWH(2, 38, DIAMETRE
- 1, DIAMETRE
- 1);
1599 /* ------------------------------------------------------------------------ */
1600 static void move_light(int factor
)
1602 ambient_light
+= factor
/ 20.0;
1603 ambient_light
= MAX(0.0, ambient_light
);
1604 ambient_light
= MIN(1.0, ambient_light
);
1605 aml
= (int) floor(ambient_light
* 256);
1607 XCopyArea(dpy
, scrdiv
.pixmap
, wmg
.pixmap
, NormalGC
,
1608 0, 15, 60, 10, 2, 14);
1613 /* ------------------------------------------------------------------------ */
1614 static void move_dawn(int factor
)
1616 dawn
= (1.0 - dawn
) * 2.0;
1617 dawn
+= factor
/ 20.0;
1618 dawn
= MAX(0.0, dawn
);
1619 dawn
= MIN(1.0, dawn
);
1620 dawn
= (1.0 - dawn
/ 2.0);
1621 XCopyArea(dpy
, scrdiv
.pixmap
, wmg
.pixmap
, NormalGC
,
1622 0, 15, 60, 10, 2, 38);
1627 /* ------------------------------------------------------------------------ */
1628 static void screen_4()
1630 int ok
, ckm
, waitrel
, sensadd
, not3
;
1634 fprintf(stdout
, "scr 4\n");
1641 XShapeCombineMask(dpy
, win
, ShapeBounding
, 0, 0, scrdate
.mask
, ShapeSet
);
1642 XShapeCombineMask(dpy
, iconwin
, ShapeBounding
, 0, 0, scrdate
.mask
, ShapeSet
);
1644 XCopyArea(dpy
, scrdate
.pixmap
, wmg
.pixmap
, NormalGC
, 0, 0, DIAMETRE
, DIAMETRE
, 0, 0);
1646 AddMouseRegion(1, 2, 14, DIAMETRE
- 2, 25);
1647 AddMouseRegion(2, 2, 38, DIAMETRE
- 2, 49);
1653 while (XPending(dpy
)) {
1654 XNextEvent(dpy
, &Event
);
1655 switch (Event
.type
) {
1657 RedrawWindowXYWH(0, 0, DIAMETRE
, DIAMETRE
);
1664 ckm
= CheckMouseRegion(Event
.xbutton
.x
, Event
.xbutton
.y
);
1667 switch (Event
.xbutton
.button
) {
1688 ckm
= CheckMouseRegion(Event
.xbutton
.x
, Event
.xbutton
.y
);
1689 if (waitrel
== ckm
) {
1694 gotoscr
= NUM_SCREEN
;
1698 if (gotoscr
> NUM_SCREEN
)
1715 usleep(VAL_USLEEP_SHORT
);
1716 if (waitrel
&& not3
) {
1718 move_light(sensadd
);
1726 if (waitrel
== 0 && diftimev(getimev(), tin
).tv_sec
> SCREEN_WAIT
&& gotoscr
== 4)
1733 /* ------------------------------------------------------------------------ */
1734 static void display_accel()
1739 write_icon(" accel :", 2, 2);
1740 RedrawWindowXYWH(2, 2, DIAMETRE
- 1, DIAMETRE
- 1);
1742 if (time_multi
< 24.0)
1743 sprintf(datest
, "%.1f", time_multi
);
1745 sprintf(datest
, "%.0f", time_multi
);
1747 i
= 10 - strlen(datest
);
1752 write_icon(datest
, 2 + i
* 6, 14);
1753 RedrawWindowXYWH(2, 14, DIAMETRE
- 1, DIAMETRE
- 1);
1755 write_icon("night map:", 2, 26);
1756 RedrawWindowXYWH(2, 26, DIAMETRE
- 1, DIAMETRE
- 1);
1759 write_icon(" yes ", 2, 38);
1761 write_icon(" no ", 2, 38);
1763 RedrawWindowXYWH(2, 38, DIAMETRE
- 1, DIAMETRE
- 1);
1767 /* ------------------------------------------------------------------------ */
1768 static void move_accel(int factor
)
1771 if (time_multi
< 1.0)
1773 if (time_multi
< 24.0)
1775 else if (time_multi
< 60.0) {
1776 time_multi
= floor(time_multi
);
1778 } else if (time_multi
< 120.0) {
1779 time_multi
= floor(time_multi
);
1781 } else if (time_multi
< 240.0) {
1782 time_multi
= floor(time_multi
);
1784 } else if (time_multi
< 600.0) {
1785 time_multi
= floor(time_multi
);
1787 } else if (time_multi
< 1200.0) {
1788 time_multi
= floor(time_multi
);
1790 } else if (time_multi
< 2400.0) {
1791 time_multi
= floor(time_multi
);
1793 } else if (time_multi
< 6000.0) {
1794 time_multi
= floor(time_multi
);
1795 time_multi
+= 100.0;
1796 } else if (time_multi
< 12000.0) {
1797 time_multi
= floor(time_multi
);
1798 time_multi
+= 200.0;
1799 } else if (time_multi
< 24000.0) {
1800 time_multi
= floor(time_multi
);
1801 time_multi
+= 400.0;
1802 } else if (time_multi
< 60000.0) {
1803 time_multi
= floor(time_multi
);
1804 time_multi
+= 1000.0;
1805 } else if (time_multi
< 120000.0) {
1806 time_multi
= floor(time_multi
);
1807 time_multi
+= 2000.0;
1808 } else if (time_multi
< 240000.0) {
1809 time_multi
= floor(time_multi
);
1810 time_multi
+= 4000.0;
1812 time_multi
= floor(time_multi
);
1813 time_multi
+= 8000.0;
1815 if (time_multi
> MAX_MULTI_COEF
)
1816 time_multi
= MAX_MULTI_COEF
;
1818 if (time_multi
< 24.1)
1820 else if (time_multi
< 60.2) {
1821 time_multi
= floor(time_multi
);
1823 } else if (time_multi
< 121.0) {
1824 time_multi
= floor(time_multi
);
1826 } else if (time_multi
< 241.0) {
1827 time_multi
= floor(time_multi
);
1829 } else if (time_multi
< 601.0) {
1830 time_multi
= floor(time_multi
);
1832 } else if (time_multi
< 1201.0) {
1833 time_multi
= floor(time_multi
);
1835 } else if (time_multi
< 2401.0) {
1836 time_multi
= floor(time_multi
);
1838 } else if (time_multi
< 6001.0) {
1839 time_multi
= floor(time_multi
);
1840 time_multi
-= 100.0;
1841 } else if (time_multi
< 12001.0) {
1842 time_multi
= floor(time_multi
);
1843 time_multi
-= 200.0;
1844 } else if (time_multi
< 24001.0) {
1845 time_multi
= floor(time_multi
);
1846 time_multi
-= 400.0;
1847 } else if (time_multi
< 60001.0) {
1848 time_multi
= floor(time_multi
);
1849 time_multi
-= 1000.0;
1850 } else if (time_multi
< 120001.0) {
1851 time_multi
= floor(time_multi
);
1852 time_multi
-= 2000.0;
1853 } else if (time_multi
< 240001.0) {
1854 time_multi
= floor(time_multi
);
1855 time_multi
-= 4000.0;
1857 time_multi
= floor(time_multi
);
1858 time_multi
-= 8000.0;
1861 if (time_multi
> 24.0)
1862 time_multi
= floor(time_multi
);
1863 if (time_multi
< 1.0)
1870 XCopyArea(dpy
, scrdiv
.pixmap
, wmg
.pixmap
, NormalGC
,
1871 0, 15, 60, 10, 2, 14);
1876 /* ------------------------------------------------------------------------ */
1877 static void screen_5()
1879 int ok
, ckm
, waitrel
, sensadd
, not3
;
1883 fprintf(stdout
, "scr 5\n");
1890 XShapeCombineMask(dpy
, win
, ShapeBounding
, 0, 0, scrdate
.mask
, ShapeSet
);
1891 XShapeCombineMask(dpy
, iconwin
, ShapeBounding
, 0, 0, scrdate
.mask
, ShapeSet
);
1893 XCopyArea(dpy
, scrdate
.pixmap
, wmg
.pixmap
, NormalGC
, 0, 0, DIAMETRE
, DIAMETRE
, 0, 0);
1895 AddMouseRegion(1, 2, 14, DIAMETRE
- 2, 25);
1896 AddMouseRegion(2, 2, 38, DIAMETRE
- 2, 49);
1902 while (XPending(dpy
)) {
1903 XNextEvent(dpy
, &Event
);
1904 switch (Event
.type
) {
1906 RedrawWindowXYWH(0, 0, DIAMETRE
, DIAMETRE
);
1913 ckm
= CheckMouseRegion(Event
.xbutton
.x
, Event
.xbutton
.y
);
1916 switch (Event
.xbutton
.button
) {
1937 ckm
= CheckMouseRegion(Event
.xbutton
.x
, Event
.xbutton
.y
);
1938 if (waitrel
== ckm
) {
1943 gotoscr
= NUM_SCREEN
;
1947 if (gotoscr
> NUM_SCREEN
)
1965 usleep(VAL_USLEEP_SHORT
);
1966 if (waitrel
&& not3
) {
1968 move_accel(sensadd
);
1974 use_nightmap
= FALSE
;
1978 use_nightmap
= TRUE
;
1985 if (waitrel
== 0 && diftimev(getimev(), tin
).tv_sec
> SCREEN_WAIT
&& gotoscr
== 5)
1992 /* ------------------------------------------------------------------------ */
1993 static void display_dlat()
1996 int i
, d
, m
, nega
, nego
;
1998 write_icon(" dlat :", 2, 2);
1999 RedrawWindowXYWH(2, 2, DIAMETRE
- 1, DIAMETRE
- 1);
2006 m
= (int) floor((dlat
- floor(dlat
)) * 60.0);
2007 d
= (int) floor(dlat
);
2010 sprintf(datest
, "-%d°%02d'", d
, m
);
2013 sprintf(datest
, "%d°%02d'", d
, m
);
2015 i
= 10 - strlen(datest
);
2020 write_icon(datest
, 2 + i
* 6, 14);
2021 RedrawWindowXYWH(2, 14, DIAMETRE
- 1, DIAMETRE
- 1);
2023 write_icon(" dlong :", 2, 26);
2024 RedrawWindowXYWH(2, 26, DIAMETRE
- 1, DIAMETRE
- 1);
2033 m
= (int) floor((dlong
- floor(dlong
)) * 60.0);
2034 d
= (int) floor(dlong
);
2037 sprintf(datest
, "-%d°%02d'", d
, m
);
2040 sprintf(datest
, "%d°%02d'", d
, m
);
2042 i
= 10 - strlen(datest
);
2047 write_icon(datest
, 2 + i
* 6, 38);
2048 RedrawWindowXYWH(2, 38, DIAMETRE
- 1, DIAMETRE
- 1);
2052 /* ------------------------------------------------------------------------ */
2053 static void move_dlat(int factor
)
2055 dlat
+= factor
/ 4.0;
2056 if (dlat
> MAX_DELTA_LONG
)
2057 dlat
= MAX_DELTA_LONG
;
2058 if (dlat
< -MAX_DELTA_LONG
)
2059 dlat
= -MAX_DELTA_LONG
;
2060 if (dlat
< 0.25 && dlat
> -0.25)
2062 XCopyArea(dpy
, scrdiv
.pixmap
, wmg
.pixmap
, NormalGC
,
2063 0, 15, 60, 10, 2, 14);
2069 /* ------------------------------------------------------------------------ */
2070 static void move_dlong(int factor
)
2072 dlong
+= factor
/ 4.0;
2073 if (dlong
> MAX_DELTA_LONG
)
2074 dlong
= MAX_DELTA_LONG
;
2075 if (dlong
< -MAX_DELTA_LONG
)
2076 dlong
= -MAX_DELTA_LONG
;
2077 if (dlong
< 0.25 && dlong
> -0.25)
2079 XCopyArea(dpy
, scrdiv
.pixmap
, wmg
.pixmap
, NormalGC
,
2080 0, 15, 60, 10, 2, 38);
2086 /* ------------------------------------------------------------------------ */
2087 static void screen_6()
2089 int ok
, ckm
, waitrel
, sensadd
, not3
;
2093 fprintf(stdout
, "scr 6\n");
2100 XShapeCombineMask(dpy
, win
, ShapeBounding
, 0, 0, scrdate
.mask
, ShapeSet
);
2101 XShapeCombineMask(dpy
, iconwin
, ShapeBounding
, 0, 0, scrdate
.mask
, ShapeSet
);
2103 XCopyArea(dpy
, scrdate
.pixmap
, wmg
.pixmap
, NormalGC
, 0, 0, DIAMETRE
, DIAMETRE
, 0, 0);
2104 AddMouseRegion(1, 2, 14, DIAMETRE
- 2, 25);
2105 AddMouseRegion(2, 2, 38, DIAMETRE
- 2, 49);
2112 while (XPending(dpy
)) {
2113 XNextEvent(dpy
, &Event
);
2114 switch (Event
.type
) {
2116 RedrawWindowXYWH(0, 0, DIAMETRE
, DIAMETRE
);
2123 ckm
= CheckMouseRegion(Event
.xbutton
.x
, Event
.xbutton
.y
);
2126 switch (Event
.xbutton
.button
) {
2147 ckm
= CheckMouseRegion(Event
.xbutton
.x
, Event
.xbutton
.y
);
2148 if (waitrel
== ckm
) {
2153 gotoscr
= NUM_SCREEN
;
2157 if (gotoscr
> NUM_SCREEN
)
2175 usleep(VAL_USLEEP_SHORT
);
2176 if (waitrel
&& not3
) {
2177 if (ckm
== 1 && p_type
!= PTRANDOM
) {
2181 if (ckm
== 2 && p_type
!= PTRANDOM
) {
2182 move_dlong(sensadd
);
2186 if (waitrel
== 0 && diftimev(getimev(), tin
).tv_sec
> SCREEN_WAIT
&& gotoscr
== 6)
2193 /* ------------------------------------------------------------------------ */
2194 static void display_type()
2196 char c
, cc
, mess
[12];
2198 write_icon(" view :", 2, 2);
2199 RedrawWindowXYWH(2, 2, DIAMETRE
- 1, DIAMETRE
- 1);
2201 if (p_type
== PTFIXED
) {
2208 sprintf(mess
, "%c move %c", c
, cc
);
2209 write_icon(mess
, 2, 14);
2210 RedrawWindowXYWH(2, 14, DIAMETRE
- 1, DIAMETRE
- 1);
2211 if (p_type
== PTSUNREL
) {
2218 sprintf(mess
, "%c sun %c", c
, cc
);
2219 write_icon(mess
, 2, 26);
2220 RedrawWindowXYWH(2, 26, DIAMETRE
- 1, DIAMETRE
- 1);
2221 if (p_type
== PTRANDOM
) {
2228 sprintf(mess
, "%c random %c", c
, cc
);
2229 write_icon(mess
, 2, 38);
2230 RedrawWindowXYWH(2, 38, DIAMETRE
- 1, DIAMETRE
- 1);
2234 /* ------------------------------------------------------------------------ */
2235 static void screen_7()
2237 int ok
, ckm
, waitrel
, sensadd
, not3
;
2241 fprintf(stdout
, "scr 7\n");
2249 XShapeCombineMask(dpy
, win
, ShapeBounding
, 0, 0, scrdate
.mask
, ShapeSet
);
2250 XShapeCombineMask(dpy
, iconwin
, ShapeBounding
, 0, 0, scrdate
.mask
, ShapeSet
);
2252 XCopyArea(dpy
, scrdate
.pixmap
, wmg
.pixmap
, NormalGC
, 0, 0, DIAMETRE
, DIAMETRE
, 0, 0);
2253 AddMouseRegion(1, 2, 14, DIAMETRE
- 2, 25);
2254 AddMouseRegion(2, 2, 26, DIAMETRE
- 2, 37);
2255 AddMouseRegion(3, 2, 38, DIAMETRE
- 2, 49);
2262 while (XPending(dpy
)) {
2263 XNextEvent(dpy
, &Event
);
2264 switch (Event
.type
) {
2266 RedrawWindowXYWH(0, 0, DIAMETRE
, DIAMETRE
);
2273 ckm
= CheckMouseRegion(Event
.xbutton
.x
, Event
.xbutton
.y
);
2276 switch (Event
.xbutton
.button
) {
2279 if (ckm
< 4 && ckm
> 0)
2297 ckm
= CheckMouseRegion(Event
.xbutton
.x
, Event
.xbutton
.y
);
2298 if (waitrel
== ckm
) {
2303 gotoscr
= NUM_SCREEN
;
2307 if (gotoscr
> NUM_SCREEN
)
2324 usleep(VAL_USLEEP_SHORT
);
2325 if (waitrel
&& not3
&& sensadd
) {
2327 if (p_type
!= PTSUNREL
) {
2335 if (p_type
!= PTFIXED
) {
2341 if (p_type
!= PTRANDOM
) {
2350 if (waitrel
== 0 && diftimev(getimev(), tin
).tv_sec
> SCREEN_WAIT
&& gotoscr
== 7)
2357 /* ------------------------------------------------------------------------ */