1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 screen.h for the Openbox window manager
4 Copyright (c) 2003-2007 Dana Jansens
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.
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.
16 See the COPYING file for a copy of the GNU General Public License.
27 #define DESKTOP_ALL (0xffffffff)
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
;
44 typedef struct ObDesktopLayout
{
45 ObOrientation orientation
;
46 ObCorner start_corner
;
50 extern ObDesktopLayout screen_desktop_layout
;
52 /*! An array of gchar*'s which are desktop names in UTF-8 format */
53 extern gchar
**screen_desktop_names
;
55 /*! Take over the screen, set the basic hints on it claming it as ours */
56 gboolean
screen_annex(void);
58 /*! Once the screen is ours, set up its initial state */
59 void screen_startup(gboolean reconfig
);
61 void screen_shutdown(gboolean reconfig
);
63 /*! Figure out the new size of the screen and adjust stuff for it */
64 void screen_resize(void);
66 /*! Change the number of available desktops */
67 void screen_set_num_desktops(guint num
);
68 /*! Change the current desktop */
69 void screen_set_desktop(guint num
, gboolean dofocus
);
70 /*! Add a new desktop either at the end or inserted at the current desktop */
71 void screen_add_desktop(gboolean current
);
72 /*! Remove a desktop, either at the end or the current desktop */
73 void screen_remove_desktop(gboolean current
);
75 guint
screen_find_desktop(guint from
, ObDirection dir
,
76 gboolean wrap
, gboolean linear
);
78 /*! Show the desktop popup/notification
79 @permanent If TRUE, the popup will stay on the screen until you call
80 screen_hide_desktop_popup(). Otherwise it will hide after a
83 void screen_show_desktop_popup(guint d
, gboolean permanent
);
85 void screen_hide_desktop_popup(void);
87 /*! Shows and focuses the desktop and hides all the client windows, or
88 returns to the normal state, showing client windows.
89 @param If show_only is non-NULL, then only that client is shown (assuming
90 show is FALSE (restoring from show-desktop mode), and the rest are
93 void screen_show_desktop(gboolean show
, struct _ObClient
*show_only
);
95 /*! Updates the desktop layout from the root property if available */
96 void screen_update_layout(void);
98 /*! Get desktop names from the root window property */
99 void screen_update_desktop_names(void);
101 /*! Installs or uninstalls a colormap for a client. If client is NULL, then
102 it handles the root colormap. */
103 void screen_install_colormap(struct _ObClient
*client
, gboolean install
);
105 void screen_update_areas(void);
107 const Rect
* screen_physical_area_all_monitors(void);
109 /*! Returns a Rect which is owned by the screen code and should not be freed */
110 const Rect
* screen_physical_area_monitor(guint head
);
112 /*! Returns the monitor which contains the active window, or the one
113 containing the pointer otherwise. */
114 guint
screen_monitor_active(void);
116 /*! Returns a Rect which is owned by the screen code and should not be freed */
117 const Rect
* screen_physical_area_active(void);
119 /*! Returns the primary monitor, as specified by the config.
120 @fixed If TRUE, then this will always return a fixed monitor, otherwise
121 it may change based on where focus is, or other heuristics.
123 guint
screen_monitor_primary(gboolean fixed
);
125 /*! Returns physical area for the primary monitor, as specified by the config.
126 @fixed If TRUE, then this will always use a fixed monitor as primary,
127 otherwise it may change based on where focus is, or other heuristics.
128 See screen_monitor_primary().
129 @return A Rect which is owned by the screen code and should not be freed
131 const Rect
* screen_physical_area_primary(gboolean fixed
);
133 /* doesn't include struts which the search area is already outside of when
134 'search' is not NULL */
135 #define SCREEN_AREA_ALL_MONITORS ((unsigned)-1)
136 #define SCREEN_AREA_ONE_MONITOR ((unsigned)-2)
138 /*! @param head is the number of the head or one of SCREEN_AREA_ALL_MONITORS,
139 SCREEN_AREA_ONE_MONITOR
140 @param search NULL or the whole monitor(s)
141 @return A Rect allocated with g_slice_new()
143 Rect
* screen_area(guint desktop
, guint head
, Rect
*search
);
145 gboolean
screen_physical_area_monitor_contains(guint head
, Rect
*search
);
147 /*! Determines which physical monitor a rectangle is on by calculating the
148 area of the part of the rectable on each monitor. The number of the
149 monitor containing the greatest area of the rectangle is returned.
151 guint
screen_find_monitor(const Rect
*search
);
153 /*! Finds the monitor which contains the point @x, @y */
154 guint
screen_find_monitor_point(guint x
, guint y
);
156 /*! Sets the root cursor. This function decides which cursor to use, but you
157 gotta call it to let it know it should change. */
158 void screen_set_root_cursor(void);
160 /*! Gives back the pointer's position in x and y. Returns TRUE if the pointer
161 is on this screen and FALSE if it is on another screen. */
162 gboolean
screen_pointer_pos(gint
*x
, gint
*y
);
164 /*! Returns the monitor which contains the pointer device */
165 guint
screen_monitor_pointer(void);