]> icculus.org git repositories - dana/openbox.git/blob - openbox/screen.h
Redraw the screen when a ObWindow is destroyed, but not on every related event
[dana/openbox.git] / openbox / screen.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3    screen.h for the Openbox window manager
4    Copyright (c) 2003-2007   Dana Jansens
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    See the COPYING file for a copy of the GNU General Public License.
17 */
18
19 #ifndef __screen_h
20 #define __screen_h
21
22 #include "misc.h"
23 #include "geom.h"
24
25 struct _ObClient;
26
27 #define DESKTOP_ALL (0xffffffff)
28
29 /*! The number of available desktops */
30 extern guint screen_num_desktops;
31 /*! The number of virtual "xinerama" screens/heads */
32 extern guint screen_num_monitors;
33 /*! The current desktop */
34 extern guint screen_desktop;
35 /*! The desktop which was last visible */
36 extern guint screen_last_desktop;
37 /*! Are we in showing-desktop mode? */
38 extern gboolean screen_showing_desktop;
39 /*! The support window also used for focus and stacking */
40 extern Window screen_support_win;
41 /*! The last time at which the user changed desktops */
42 extern Time screen_desktop_user_time;
43 /*! The atom for the selection we hold on the screen to claim ourselves as the
44   current window manager */
45 extern Atom screen_wm_sn_atom;
46
47 typedef struct ObDesktopLayout {
48     ObOrientation orientation;
49     ObCorner start_corner;
50     guint rows;
51     guint columns;
52 } ObDesktopLayout;
53 extern ObDesktopLayout screen_desktop_layout;
54
55 /*! An array of gchar*'s which are desktop names in UTF-8 format */
56 extern gchar **screen_desktop_names;
57
58 /*! Take over the screen, set the basic hints on it claming it as ours */
59 gboolean screen_annex(void);
60
61 /*! Once the screen is ours, set up its initial state */
62 void screen_startup(gboolean reconfig);
63 /*! Free resources */
64 void screen_shutdown(gboolean reconfig);
65
66 /*! Figure out the new size of the screen and adjust stuff for it */
67 void screen_resize(void);
68
69 /*! Change the number of available desktops */
70 void screen_set_num_desktops(guint num);
71 /*! Change the current desktop */
72 void screen_set_desktop(guint num, gboolean dofocus);
73 /*! Add a new desktop either at the end or inserted at the current desktop */
74 void screen_add_desktop(gboolean current);
75 /*! Remove a desktop, either at the end or the current desktop */
76 void screen_remove_desktop(gboolean current);
77
78 guint screen_find_desktop(guint from, ObDirection dir,
79                           gboolean wrap, gboolean linear);
80
81 /*! Show the desktop popup/notification
82   @permanent If TRUE, the popup will stay on the screen until you call
83              screen_hide_desktop_popup().  Otherwise it will hide after a
84              delay.
85  */
86 void screen_show_desktop_popup(guint d, gboolean permanent);
87 /*! Hide it */
88 void screen_hide_desktop_popup(void);
89
90 /*! Shows and focuses the desktop and hides all the client windows, or
91   returns to the normal state, showing client windows.
92   @param If show_only is non-NULL, then only that client is shown (assuming
93          show is FALSE (restoring from show-desktop mode), and the rest are
94          iconified.
95 */
96 void screen_show_desktop(gboolean show, struct _ObClient *show_only);
97
98 /*! Updates the desktop layout from the root property if available */
99 void screen_update_layout(void);
100
101 /*! Get desktop names from the root window property */
102 void screen_update_desktop_names(void);
103
104 /*! Installs or uninstalls a colormap for a client. If client is NULL, then
105   it handles the root colormap. */
106 void screen_install_colormap(struct _ObClient *client, gboolean install);
107
108 void screen_update_areas(void);
109
110 const Rect* screen_physical_area_all_monitors(void);
111
112 /*! Returns a Rect which is owned by the screen code and should not be freed */
113 const Rect* screen_physical_area_monitor(guint head);
114
115 /*! Returns the monitor which contains the active window, or the one
116   containing the pointer otherwise. */
117 guint screen_monitor_active(void);
118
119 /*! Returns a Rect which is owned by the screen code and should not be freed */
120 const Rect* screen_physical_area_active(void);
121
122 /*! Returns the primary monitor, as specified by the config.
123   @fixed If TRUE, then this will always return a fixed monitor, otherwise
124          it may change based on where focus is, or other heuristics.
125  */
126 guint screen_monitor_primary(gboolean fixed);
127
128 /*! Returns physical area for the primary monitor, as specified by the config.
129   @fixed If TRUE, then this will always use a fixed monitor as primary,
130          otherwise it may change based on where focus is, or other heuristics.
131          See screen_monitor_primary().
132   @return A Rect which is owned by the screen code and should not be freed
133 */
134 const Rect* screen_physical_area_primary(gboolean fixed);
135
136 /* doesn't include struts which the search area is already outside of when
137    'search' is not NULL */
138 #define SCREEN_AREA_ALL_MONITORS ((unsigned)-1)
139 #define SCREEN_AREA_ONE_MONITOR  ((unsigned)-2)
140
141 /*! @param head is the number of the head or one of SCREEN_AREA_ALL_MONITORS,
142            SCREEN_AREA_ONE_MONITOR
143     @param search NULL or the whole monitor(s)
144     @return A Rect allocated with g_slice_new()
145  */
146 Rect* screen_area(guint desktop, guint head, Rect *search);
147
148 gboolean screen_physical_area_monitor_contains(guint head, Rect *search);
149
150 /*! Determines which physical monitor a rectangle is on by calculating the
151     area of the part of the rectable on each monitor.  The number of the
152     monitor containing the greatest area of the rectangle is returned.
153 */
154 guint screen_find_monitor(const Rect *search);
155
156 /*! Finds the monitor which contains the point @x, @y */
157 guint screen_find_monitor_point(guint x, guint y);
158
159 /*! Sets the root cursor. This function decides which cursor to use, but you
160   gotta call it to let it know it should change. */
161 void screen_set_root_cursor(void);
162
163 /*! Gives back the pointer's position in x and y. Returns TRUE if the pointer
164   is on this screen and FALSE if it is on another screen. */
165 gboolean screen_pointer_pos(gint *x, gint *y);
166
167 /*! Returns the monitor which contains the pointer device */
168 guint screen_monitor_pointer(void);
169
170 #endif