1 /* $Id$ 2 3 This program is free software; you can redistribute it and/or modify 4 it under the terms of the GNU General Public License as published by 5 the Free Software Foundation; either version 2, or (at your option) 6 any later version. 7 8 This program is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License 14 along with this program; if not, write to the Free Software 15 Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston, 16 MA 02110-1301, USA. 17 18 19 oroborus - (c) 2001 Ken Lynch 20 Metacity - (c) 2001 Havoc Pennington 21 xfwm4 - (c) 2002-2020 Olivier Fourdan 22 23 */ 24 25 #ifndef INC_HINTS_H 26 #define INC_HINTS_H 27 28 #ifdef HAVE_CONFIG_H 29 #include "config.h" 30 #endif 31 32 #include <X11/X.h> 33 #include <X11/Xlib.h> 34 #include <X11/Xutil.h> 35 #include <X11/Xmd.h> 36 #include <X11/Xatom.h> 37 #include <glib.h> 38 #include <gdk/gdk.h> 39 40 #include "display.h" 41 42 #define MWM_HINTS_ELEMENTS 3L 43 #define MAX_STR_LENGTH 255 44 45 #define MWM_HINTS_FUNCTIONS (1L << 0) 46 #define MWM_HINTS_DECORATIONS (1L << 1) 47 #define MWM_HINTS_INPUT_MODE (1L << 2) 48 #define MWM_HINTS_STATUS (1L << 3) 49 50 #define MWM_FUNC_ALL (1L << 0) 51 #define MWM_FUNC_RESIZE (1L << 1) 52 #define MWM_FUNC_MOVE (1L << 2) 53 #define MWM_FUNC_MINIMIZE (1L << 3) 54 #define MWM_FUNC_MAXIMIZE (1L << 4) 55 #define MWM_FUNC_CLOSE (1L << 5) 56 57 #define MWM_DECOR_ALL (1L << 0) 58 #define MWM_DECOR_BORDER (1L << 1) 59 #define MWM_DECOR_RESIZEH (1L << 2) 60 #define MWM_DECOR_TITLE (1L << 3) 61 #define MWM_DECOR_MENU (1L << 4) 62 #define MWM_DECOR_MINIMIZE (1L << 5) 63 #define MWM_DECOR_MAXIMIZE (1L << 6) 64 65 #define MWM_INPUT_MODELESS 0 66 #define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 67 #define MWM_INPUT_SYSTEM_MODAL 2 68 #define MWM_INPUT_FULL_APPLICATION_MODAL 3 69 #define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL 70 71 #define MWM_TEAROFF_WINDOW (1L<<0) 72 73 #define WM_PROTOCOLS_TAKE_FOCUS (1L<<0) 74 #define WM_PROTOCOLS_DELETE_WINDOW (1L<<1) 75 #define WM_PROTOCOLS_CONTEXT_HELP (1L<<2) 76 #define WM_PROTOCOLS_PING (1L<<3) 77 78 #define WIN_LAYER_DESKTOP 0 79 #define WIN_LAYER_BELOW 2 80 #define WIN_LAYER_NORMAL 4 81 #define WIN_LAYER_ONTOP 6 82 #define WIN_LAYER_DOCK 8 83 #define WIN_LAYER_ABOVE_DOCK 10 84 #define WIN_LAYER_FULLSCREEN 12 85 #define WIN_LAYER_NOTIFICATION 14 86 87 #define NET_WM_MOVERESIZE_SIZE_TOPLEFT 0 88 #define NET_WM_MOVERESIZE_SIZE_TOP 1 89 #define NET_WM_MOVERESIZE_SIZE_TOPRIGHT 2 90 #define NET_WM_MOVERESIZE_SIZE_RIGHT 3 91 #define NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT 4 92 #define NET_WM_MOVERESIZE_SIZE_BOTTOM 5 93 #define NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT 6 94 #define NET_WM_MOVERESIZE_SIZE_LEFT 7 95 #define NET_WM_MOVERESIZE_MOVE 8 96 97 #define NET_WM_STATE_REMOVE 0 98 #define NET_WM_STATE_ADD 1 99 #define NET_WM_STATE_TOGGLE 2 100 101 #define NET_WM_ORIENTATION_HORZ 0 102 #define NET_WM_ORIENTATION_VERT 1 103 104 #define NET_WM_TOPLEFT 0 105 #define NET_WM_TOPRIGHT 1 106 #define NET_WM_BOTTOMRIGHT 2 107 #define NET_WM_BOTTOMLEFT 3 108 109 #define NET_WM_OPAQUE G_MAXUINT32 110 111 #define STRUTS_LEFT 0 112 #define STRUTS_RIGHT 1 113 #define STRUTS_TOP 2 114 #define STRUTS_BOTTOM 3 115 #define STRUTS_LEFT_START_Y 4 116 #define STRUTS_LEFT_END_Y 5 117 #define STRUTS_RIGHT_START_Y 6 118 #define STRUTS_RIGHT_END_Y 7 119 #define STRUTS_TOP_START_X 8 120 #define STRUTS_TOP_END_X 9 121 #define STRUTS_BOTTOM_START_X 10 122 #define STRUTS_BOTTOM_END_X 11 123 124 /* Convenient macro */ 125 #define HINTS_ACCEPT_INPUT(wmhints) (!(wmhints) || \ 126 ((wmhints) && !(wmhints->flags & InputHint)) || \ 127 ((wmhints) && (wmhints->flags & InputHint) && (wmhints->input))) 128 129 typedef struct 130 { 131 unsigned long orientation; 132 unsigned long start; 133 unsigned long rows; 134 unsigned long cols; 135 } 136 NetWmDesktopLayout; 137 138 139 typedef struct 140 { 141 unsigned long flags; 142 unsigned long functions; 143 unsigned long decorations; 144 } 145 PropMwmHints; 146 147 unsigned long getWMState (DisplayInfo *, 148 Window); 149 void setWMState (DisplayInfo *, 150 Window, 151 unsigned long); 152 PropMwmHints *getMotifHints (DisplayInfo *, 153 Window); 154 unsigned int getWMProtocols (DisplayInfo *, 155 Window); 156 gboolean getHint (DisplayInfo *, 157 Window, 158 int, 159 long *); 160 void setHint (DisplayInfo *, 161 Window, 162 int, 163 long); 164 void getDesktopLayout (DisplayInfo *, 165 Window, 166 int, 167 NetWmDesktopLayout *); 168 void setNetSupportedHint (DisplayInfo *, 169 Window, 170 Window); 171 gboolean getAtomList (DisplayInfo *, 172 Window, 173 int, 174 Atom **, 175 int *); 176 gboolean getCardinalList (DisplayInfo *, 177 Window, 178 int, 179 unsigned long **, 180 int *); 181 void setNetWorkarea (DisplayInfo *, 182 Window, 183 int, 184 int, 185 int, 186 int *); 187 void setNetFrameExtents (DisplayInfo *, 188 Window, 189 int, 190 int, 191 int, 192 int); 193 void setNetFullscreenMonitors (DisplayInfo *, 194 Window, 195 gint, 196 gint, 197 gint, 198 gint); 199 int getNetCurrentDesktop (DisplayInfo *, 200 Window root); 201 void setNetCurrentDesktop (DisplayInfo *, 202 Window, 203 int); 204 void initNetDesktopInfo (DisplayInfo *, 205 Window, 206 int, 207 int, 208 int); 209 void setNetDesktopInfo (DisplayInfo *, 210 Window, 211 int, 212 int, 213 int); 214 void setUTF8StringHint (DisplayInfo *, 215 Window, 216 int, 217 const gchar *); 218 void getTransientFor (DisplayInfo *, 219 Window, 220 Window, 221 Window *); 222 gboolean getWindowName (DisplayInfo *, 223 Window, 224 gchar **); 225 gboolean getUTF8String (DisplayInfo *, 226 Window, 227 int, 228 gchar **, 229 guint *); 230 gboolean getUTF8StringList (DisplayInfo *, 231 Window, 232 int, 233 gchar ***, 234 guint *); 235 gboolean getWindowProp (DisplayInfo *, 236 Window, 237 int, 238 Window *); 239 gboolean getWindowHostname (DisplayInfo *, 240 Window, 241 gchar **); 242 gboolean getWindowRole (DisplayInfo *, 243 Window, 244 gchar **); 245 Window getClientLeader (DisplayInfo *, 246 Window); 247 gboolean getNetWMUserTime (DisplayInfo *, 248 Window, 249 guint32 *); 250 Window getNetWMUserTimeWindow (DisplayInfo *, 251 Window); 252 gboolean getClientID (DisplayInfo *, 253 Window, 254 gchar **); 255 gboolean getWindowCommand (DisplayInfo *, 256 Window, 257 char ***, 258 int *); 259 gboolean getKDEIcon (DisplayInfo *, 260 Window, 261 Pixmap *, 262 Pixmap *); 263 gboolean getRGBIconData (DisplayInfo *, 264 Window, 265 unsigned long **, 266 unsigned long *); 267 gboolean getOpacity (DisplayInfo *, 268 Window, 269 guint32 *); 270 gboolean getBypassCompositor (DisplayInfo *, 271 Window, 272 guint32 *); 273 gboolean getOpacityLock (DisplayInfo *, 274 Window); 275 gboolean setXAtomManagerOwner (DisplayInfo *, 276 Atom, 277 Window, 278 Window); 279 gboolean setAtomIdManagerOwner (DisplayInfo *, 280 int, 281 Window , 282 Window); 283 void updateXserverTime (DisplayInfo *); 284 guint32 getXServerTime (DisplayInfo *); 285 #ifdef ENABLE_KDE_SYSTRAY_PROXY 286 gboolean checkKdeSystrayWindow (DisplayInfo *, 287 Window); 288 void sendSystrayReqDock (DisplayInfo *, 289 Window, 290 Window); 291 Window getSystrayWindow (DisplayInfo *, 292 Atom); 293 #endif 294 295 #ifdef HAVE_LIBSTARTUP_NOTIFICATION 296 gboolean getWindowStartupId (DisplayInfo *, 297 Window, 298 char **); 299 #endif 300 301 GPid getWindowPID (DisplayInfo *, 302 Window); 303 unsigned int getOpaqueRegionRects (DisplayInfo *, 304 Window, 305 XRectangle **); 306 307 #endif /* INC_HINTS_H */ 308