]> git.decadent.org.uk Git - ion3.git/blob - ioncore/screen.h
8c1b9b5963ed98f0c492d3096302e280800f7eb3
[ion3.git] / ioncore / screen.h
1 /*
2  * ion/ioncore/screen.h
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2007. 
5  *
6  * Ion is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1 of the License, or
9  * (at your option) any later version.
10  */
11
12 #ifndef ION_IONCORE_SCREEN_H
13 #define ION_IONCORE_SCREEN_H
14
15 #include <libextl/extl.h>
16 #include <libmainloop/hooks.h>
17 #include "common.h"
18 #include "mplex.h"
19 #include "rectangle.h"
20 #include "pholder.h"
21
22 #define FOR_ALL_SCREENS(SCR)   \
23     for((SCR)=ioncore_g.screens; \
24         (SCR)!=NULL;           \
25         (SCR)=(SCR)->next_scr)
26
27 #define FOR_ALL_SCREENS_W_NEXT(SCR, NXT)                               \
28     for((SCR)=ioncore_g.screens, NXT=((SCR) ? (SCR)->next_scr : NULL); \
29         (SCR)!=NULL;                                                   \
30         (SCR)=(NXT), NXT=((SCR) ? (SCR)->next_scr : NULL))
31
32 enum{
33     SCREEN_ROTATION_0,
34     SCREEN_ROTATION_90,
35     SCREEN_ROTATION_180,
36     SCREEN_ROTATION_270
37 };
38
39
40 DECLCLASS(WScreen){
41     WMPlex mplex;
42     int id;
43     Atom atom_workspace;
44     bool uses_root;
45     WRectangle managed_off;
46     WScreen *next_scr, *prev_scr;
47     Watch notifywin_watch;
48     Watch infowin_watch;
49 };
50
51 /* rootwin should only be set if parent is NULL, and this WScreen is
52  * actually a root window.
53  */
54 extern bool screen_init(WScreen *scr, WRootWin *parent, 
55                         const WFitParams *fp, int id, Window rootwin);
56
57 extern WScreen *create_screen(WRootWin *parent, const WFitParams *fp, int id);
58
59 extern void screen_deinit(WScreen *scr);
60
61 extern int screen_id(WScreen *scr);
62
63 extern void screen_set_managed_offset(WScreen *scr, const WRectangle *off);
64
65 extern bool screen_init_layout(WScreen *scr, ExtlTab tab);
66
67 extern WScreen *ioncore_find_screen_id(int id);
68 extern WScreen *ioncore_goto_screen_id(int id);
69 extern WScreen *ioncore_goto_next_screen();
70 extern WScreen *ioncore_goto_prev_screen();
71
72 /* Handlers of this hook receive a WScreen* as the sole parameter. */
73 extern WHook *screen_managed_changed_hook;
74
75 #endif /* ION_IONCORE_SCREEN_H */