1 /* -*-c-*- */
2 #ifndef FVWMLIB_FSCRREN_H
3 #define FVWMLIB_FSCRREN_H
4 
5 /* needs X11/Xlib.h and X11/Xutil.h */
6 
7 typedef enum
8 {
9 	FSCREEN_GLOBAL  = -1,
10 	FSCREEN_CURRENT = -2,
11 	FSCREEN_PRIMARY = -3,
12 	FSCREEN_XYPOS   = -4
13 } fscreen_scr_t;
14 
15 typedef enum
16 {
17 	FSCREEN_SPEC_GLOBAL = 'g',
18 	FSCREEN_SPEC_CURRENT = 'c',
19 	FSCREEN_SPEC_PRIMARY = 'p',
20 	FSCREEN_SPEC_WINDOW = 'w'
21 } fscreen_scr_spec_t;
22 
23 typedef union
24 {
25 	XEvent *mouse_ev;
26 	struct
27 	{
28 		int x;
29 		int y;
30 	} xypos;
31 } fscreen_scr_arg;
32 
33 #define FSCREEN_MANGLE_USPOS_HINTS_MAGIC ((short)-32109)
34 
35 
36 /* Control */
37 Bool FScreenIsEnabled(void);
38 Bool FScreenIsSLSEnabled(void);
39 void FScreenInit(Display *dpy);
40 void FScreenOnOff(Bool do_enable);
41 Bool FScreenConfigureSLSSize(int width, int height);
42 Bool FScreenConfigureSLSScreens(int nscreens, char *args);
43 void FScreenSLSOnOff(Bool do_enable);
44 /* Intended to be called by modules.  Simply pass in the parameter from the
45  * config string sent by fvwm. */
46 void FScreenConfigureModule(char *args);
47 const char* FScreenGetConfiguration(void); /* For use by fvwm */
48 void FScreenSetDefaultModuleScreen(char *scr_spec);
49 void FScreenDisableRandR(void);
50 
51 void FScreenSetPrimaryScreen(int scr);
52 
53 /* Screen info */
54 Bool FScreenGetScrRect(
55 	fscreen_scr_arg *arg, fscreen_scr_t screen, int *x, int *y,
56 	int *w, int *h);
57 Bool FScreenGetScrId(
58 	fscreen_scr_arg *arg, fscreen_scr_t screen);
59 void FScreenTranslateCoordinates(
60 	fscreen_scr_arg *arg_src, fscreen_scr_t screen_src,
61 	fscreen_scr_arg *arg_dest, fscreen_scr_t screen_dest,
62 	int *x, int *y);
63 void FScreenGetResistanceRect(
64 	int wx, int wy, unsigned int ww, unsigned int wh, int *x0, int *y0,
65 	int *x1, int *y1);
66 Bool FScreenIsRectangleOnScreen(
67 	fscreen_scr_arg *arg, fscreen_scr_t screen, rectangle *rec);
68 void FScreenSpecToString(char *dest, int space, fscreen_scr_t screen);
69 int FScreenOfPointerXY(int x, int y);
70 
71 
72 /* Clipping/positioning */
73 int FScreenClipToScreen(
74 	fscreen_scr_arg *arg, fscreen_scr_t screen, int *x, int *y, int w,
75 	int h);
76 void FScreenCenterOnScreen(
77 	fscreen_scr_arg *arg, fscreen_scr_t screen, int *x, int *y, int w,
78 	int h);
79 
80 /* Geometry management */
81 int FScreenGetScreenArgument(char *scr_spec, fscreen_scr_spec_t default_screen);
82 int FScreenParseGeometryWithScreen(
83 	char *parsestring, int *x_return, int *y_return,
84 	unsigned int *width_return, unsigned int *height_return,
85 	int *screen_return);
86 int FScreenParseGeometry(
87 	char *parsestring, int *x_return, int *y_return,
88 	unsigned int *width_return, unsigned int *height_return);
89 int  FScreenGetGeometry(
90 	char *parsestring, int *x_return, int *y_return,
91 	int *width_return, int *height_return, XSizeHints *hints, int flags);
92 void FScreenMangleScreenIntoUSPosHints(fscreen_scr_t screen, XSizeHints *hints);
93 fscreen_scr_t FScreenFetchMangledScreenFromUSPosHints(XSizeHints *hints);
94 
95 /* RandR support */
96 int  FScreenGetRandrEventType(void);
97 Bool FScreenHandleRandrEvent(
98 	XEvent *event, int *old_w, int *old_h, int *new_w, int *new_h);
99 
100 #endif /* FVWMLIB_FSCRREN_H */
101