2 * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
3 * Copyright (C) 2004-2009 Kim Woelders
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to
7 * deal in the Software without restriction, including without limitation the
8 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 * sell copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies of the Software, its documentation and marketing & publicity
14 * materials, and acknowledgment shall be given in the documentation, materials
15 * and software packages that this Software was used.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 /* Window operation sources */
41 unsigned char border:1; /* W */
42 unsigned char close:1; /* AU */
43 unsigned char focus:1; /* WA */
44 unsigned char iconify:1; /* W U */
45 unsigned char move:1; /* AU */
46 unsigned char size:1; /* AU */
50 #define EwinInhGetApp(ewin, item) (ewin->inh_app.b.item)
51 #define EwinInhSetApp(ewin, item, on) ewin->inh_app.b.item = (on)
52 #define EwinInhGetUser(ewin, item) (ewin->inh_user.b.item)
53 #define EwinInhSetUser(ewin, item, on) ewin->inh_user.b.item = (on)
54 #define EwinInhGetWM(ewin, item) (ewin->inh_wm.b.item)
55 #define EwinInhSetWM(ewin, item, on) ewin->inh_wm.b.item = (on)
58 void (*Init) (EWin * ewin);
59 void (*Layout) (EWin * ewin, int *px, int *py, int *pw,
61 void (*MoveResize) (EWin * ewin, int resize);
62 void (*Close) (EWin * ewin);
71 const Border *normal_border;
87 unsigned identified:1;
92 unsigned click_grab_isset:1;
93 unsigned maximized_horz:1;
94 unsigned maximized_vert:1;
95 unsigned fullscreen:1;
101 unsigned showingdesk:1; /* Iconified by show desktop */
105 unsigned show_coords:1;
106 unsigned maximizing:1;
108 unsigned in_action:1;
110 /* Derived state flags. Change only in EwinStateUpdate() */
111 unsigned no_border:1;
112 unsigned donthide:1; /* Don't hide on show desktop */
114 unsigned inhibit_move:1;
115 unsigned inhibit_resize:1;
116 unsigned inhibit_iconify:1;
117 unsigned inhibit_shade:1;
118 unsigned inhibit_stick:1;
119 unsigned inhibit_max_hor:1;
120 unsigned inhibit_max_ver:1;
121 unsigned inhibit_fullscreeen:1;
122 unsigned inhibit_change_desk:1;
123 unsigned inhibit_close:1;
124 unsigned inhibit_stacking:1;
126 unsigned inhibit_actions:1;
127 unsigned inhibit_focus:1;
131 unsigned int focused_opacity;
132 unsigned never_use_area:1;
133 unsigned ignorearrange:1;
134 unsigned skip_ext_task:1;
135 unsigned skip_ext_pager:1;
136 unsigned skip_focuslist:1;
137 unsigned skip_winlist:1;
138 unsigned focusclick:1; /* Click to focus */
139 unsigned no_button_grabs:1;
140 unsigned autoshade:1; /* Autoshade on mouse in/out */
141 unsigned no_argb:1; /* Do not use ARGB frame */
143 /* Derived from other properties */
144 unsigned no_border:1; /* Never apply border (MWM/netwm type) */
145 unsigned no_resize_h:1; /* ICCCM */
146 unsigned no_resize_v:1; /* ICCCM */
150 unsigned donthide:1; /* Don't hide on show desktop */
151 unsigned vroot:1; /* Virtual root window */
152 unsigned no_actions:1;
153 unsigned focus_when_mapped:1;
156 EWinInhibit inh_user;
165 char start_iconified;
166 Pixmap icon_pmap, icon_mask;
173 /* WM_TRANSIENT_FOR */
174 signed char transient;
175 Window transient_for; /* We are a transient for ... */
176 int transient_count; /* We have <N> transients */
177 /* WM_CLIENT_LEADER */
178 Window client_leader;
180 /* WM_NORMAL_HINTS */
181 int width_min, width_max;
182 int height_min, height_max;
186 double aspect_min, aspect_max;
188 char is_group_leader;
192 unsigned decor_border:1;
193 unsigned decor_resizeh:1;
194 unsigned decor_title:1;
195 unsigned decor_menu:1;
196 unsigned decor_minimize:1;
197 unsigned decor_maximize:1;
198 unsigned func_resize:1;
199 unsigned func_move:1;
200 unsigned func_minimize:1;
201 unsigned func_maximize:1;
202 unsigned func_close:1;
207 unsigned int *wm_icon, wm_icon_len;
208 unsigned int opacity;
210 char sync_request_enable;
211 XID sync_request_counter;
212 long long sync_request_count;
230 int ax, ay; /* Current placed area */
231 int gx, gy; /* Distance to edge given by gravity */
234 int left, right, top, bottom;
248 int shape_x, shape_y, shape_w, shape_h;
252 int head; /* Unused? */
254 int vx, vy; /* Position in virtual root */
255 struct { /* Saved state before maximization */
256 int x, y; /* Position */
259 struct { /* Saved state before fullscreen */
260 int x, y; /* Position */
262 int layer; /* Layer */
265 void *data; /* Data hook for internal windows */
268 Timer *timer; /* Autoshade timer */
271 #define EWIN_STATE_NEW 0 /* New */
272 #define EWIN_STATE_STARTUP 1 /* New - during startup */
273 #define EWIN_STATE_WITHDRAWN 2
274 #define EWIN_STATE_ICONIC 3
275 #define EWIN_STATE_MAPPED 4
277 #define EWIN_TYPE_NORMAL 0x00
278 #define EWIN_TYPE_DIALOG 0x01
279 #define EWIN_TYPE_MENU 0x02
280 #define EWIN_TYPE_ICONBOX 0x04
281 #define EWIN_TYPE_PAGER 0x08
282 #define EWIN_TYPE_MISC 0x10
284 #define EWIN_GRAVITY_NW 0
285 #define EWIN_GRAVITY_NE 1
286 #define EWIN_GRAVITY_SW 2
287 #define EWIN_GRAVITY_SE 3
289 #define EwinGetDesk(ewin) EoGetDesk(ewin)
291 #define EwinIsMapped(ewin) ((ewin)->state.state >= EWIN_STATE_MAPPED)
292 #define EwinIsInternal(ewin) ((ewin)->type != EWIN_TYPE_NORMAL)
293 #define EwinIsTransientChild(ewin) ((ewin)->icccm.transient > 0)
294 #define EwinIsTransient(ewin) ((ewin)->icccm.transient != 0)
295 #define EwinGetTransientFor(ewin) ((ewin)->icccm.transient_for)
296 #define EwinGetTransientCount(ewin) ((ewin)->icccm.transient_count)
297 #define EwinIsWindowGroupLeader(ewin) ((ewin)->icccm.is_group_leader)
298 #define EwinGetWindowGroup(ewin) ((ewin)->icccm.group)
300 #define EwinGetClientWin(ewin) ((ewin)->client.win)
301 #define EwinGetContainerWin(ewin) ((ewin)->win_container)
303 #define EwinGetIcccmName(ewin) EoGetName(ewin)
304 #define EwinGetIcccmCName(ewin) EoGetCName(ewin)
305 #define EwinGetIcccmClass(ewin) EoGetClass(ewin)
308 #define ARRANGE_VERBATIM 0
309 #define ARRANGE_BY_SIZE 1
310 #define ARRANGE_BY_POSITION 2
312 void SnapEwin(EWin * ewin, int dx, int dy, int *new_dx,
314 void ArrangeEwin(EWin * ewin);
315 void ArrangeEwinCentered(EWin * ewin);
316 void ArrangeEwinXY(EWin * ewin, int *px, int *py);
317 void ArrangeEwinCenteredXY(EWin * ewin, int *px, int *py);
319 void ArrangeEwins(const char *params);
322 void CoordsShow(EWin * ewin);
323 void CoordsShowOpacity(EWin * ewin);
324 void CoordsHide(void);
327 void DockIt(EWin * ewin);
330 void DrawEwinShape(EWin * ewin, int md, int x, int y, int w,
331 int h, int firstlast, int seqno);
334 #define EWIN_CHANGE_NAME (1<<0)
335 #define EWIN_CHANGE_ICON_NAME (1<<1)
336 #define EWIN_CHANGE_ICON_PMAP (1<<2)
337 #define EWIN_CHANGE_DESKTOP (1<<3)
338 #define EWIN_CHANGE_LAYER (1<<4)
339 #define EWIN_CHANGE_OPACITY (1<<5)
340 #define EWIN_CHANGE_ATTENTION (1<<6)
342 Window EwinGetClientXwin(const EWin * ewin);
343 Window EwinGetContainerXwin(const EWin * ewin);
345 void EwinShapeSet(EWin * ewin);
346 void EwinRaise(EWin * ewin);
347 void EwinLower(EWin * ewin);
348 void EwinShow(EWin * ewin);
349 void EwinHide(EWin * ewin);
350 void EwinKill(EWin * ewin);
351 void DetermineEwinFloat(EWin * ewin, int dx, int dy);
352 EWin *GetEwinPointerInClient(void);
353 EWin *GetFocusEwin(void);
354 EWin *GetContextEwin(void);
355 void SetContextEwin(EWin * ewin);
356 void EwinGetPosition(const EWin * ewin, int x, int y, int grav,
358 void EwinUpdateShapeInfo(EWin * ewin);
359 void EwinPropagateShapes(EWin * ewin);
360 void EwinStateUpdate(EWin * ewin);
361 EWin *AddInternalToFamily(Win win, const char *bname, int type,
362 const EWinOps * ops, void *ptr);
363 void EwinReparent(EWin * ewin, Win parent);
364 void EwinSetTitle(EWin * ewin, const char *title);
365 void EwinSetClass(EWin * ewin, const char *name,
367 const char *EwinGetTitle(const EWin * ewin);
368 const char *EwinGetIconName(const EWin * ewin);
369 const char *EwinBorderGetName(const EWin * ewin);
370 void EwinBorderGetSize(const EWin * ewin, int *bl, int *br,
372 void EwinBorderUpdateState(EWin * ewin);
373 int EwinIsOnScreen(const EWin * ewin);
374 void EwinRememberPositionSet(EWin * ewin);
375 void EwinRememberPositionGet(EWin * ewin, Desk * dsk,
377 void EwinSetPlacementGravity(EWin * ewin, int x, int y);
378 void EwinReposition(EWin * ewin);
379 void EwinFlagsEncode(const EWin * ewin, unsigned int *flags);
380 void EwinFlagsDecode(EWin * ewin, const unsigned int *flags);
381 void EwinUpdateOpacity(EWin * ewin);
383 void EwinChange(EWin * ewin, unsigned int flag);
385 void EwinWarpTo(EWin * ewin);
387 EWin **EwinListTransients(const EWin * ewin, int *num, int group);
388 EWin **EwinListTransientFor(const EWin * ewin, int *num);
390 void EwinsManage(void);
391 void EwinsSetFree(void);
392 void EwinsShowDesktop(int on);
393 void EwinsMoveStickyToDesk(Desk * d);
396 void SlideEwinTo(EWin * ewin, int fx, int fy, int tx, int ty,
397 int speed, int mode);
398 void SlideEwinsTo(EWin ** ewin, int *fx, int *fy, int *tx,
399 int *ty, int num_wins, int speed, int mode);
400 void EwinMove(EWin * ewin, int x, int y);
401 void EwinResize(EWin * ewin, int w, int h);
402 void EwinMoveResize(EWin * ewin, int x, int y, int w, int h);
403 void EwinMoveResizeWithGravity(EWin * ewin, int x, int y, int w,
405 void EwinMoveToDesktop(EWin * ewin, Desk * d);
406 void EwinMoveToDesktopAt(EWin * ewin, Desk * d, int x, int y);
407 void EwinIconify(EWin * ewin);
408 void EwinAlone(EWin * ewin);
409 void EwinDeIconify(EWin * ewin);
410 void EwinInstantShade(EWin * ewin, int force);
411 void EwinInstantUnShade(EWin * ewin);
412 void EwinShade(EWin * ewin);
413 void EwinUnShade(EWin * ewin);
414 void EwinMoveToArea(EWin * ewin, int ax, int ay);
416 void EwinOpMove(EWin * ewin, int source, int x, int y);
417 void EwinOpResize(EWin * ewin, int source, int w, int h);
418 void EwinOpMoveResize(EWin * ewin, int source, int x, int y,
420 void EwinOpMoveToDesktopAt(EWin * ewin, int source, Desk * dsk,
422 void EwinOpFloatAt(EWin * ewin, int source, int x, int y);
423 void EwinOpUnfloatAt(EWin * ewin, int source, Desk * d,
425 void EwinOpClose(EWin * ewin, int source);
426 void EwinOpActivate(EWin * ewin, int source, int raise);
427 void EwinOpKill(EWin * ewin, int source);
428 void EwinOpRaise(EWin * ewin, int source);
429 void EwinOpLower(EWin * ewin, int source);
430 void EwinOpStick(EWin * ewin, int source, int on);
431 void EwinOpSkipLists(EWin * ewin, int source, int skip);
432 void EwinOpIconify(EWin * ewin, int source, int on);
433 void EwinOpShade(EWin * ewin, int source, int on);
434 void EwinOpSetLayer(EWin * ewin, int source, int layer);
435 void EwinOpSetBorder(EWin * ewin, int source, const char *name);
436 void EwinOpSetOpacity(EWin * ewin, int source, int opacity);
437 void EwinOpSetFocusedOpacity(EWin * ewin, int source,
439 void EwinOpMoveToDesk(EWin * ewin, int source, Desk * dsk,
441 void EwinOpFullscreen(EWin * ewin, int source, int on);
444 EWin *EwinFindByPtr(const EWin * ewin);
445 EWin *EwinFindByClient(Window win);
446 EWin *EwinFindByChildren(Window win);
447 EWin **EwinsFindByExpr(const char *match, int *pnum, int *pflags);
448 EWin *EwinFindByExpr(const char *match);
450 /* icccm.c (for now) */
452 int EwinSyncRequestSend(EWin * ewin);
453 void EwinSyncRequestWait(EWin * ewin);
457 int ActionMoveStart(EWin * ewin, int kbd, int constrained,
459 int ActionResizeStart(EWin * ewin, int kbd, int hv);
461 int ActionsSuspend(void);
462 int ActionsResume(void);
463 void ActionsHandleKey(unsigned int key);
464 void ActionsHandleMotion(void);
465 int ActionsEnd(EWin * ewin);
468 void MaxSizeHV(EWin * ewin, const char *resize_type,
472 EWin *const *EwinListStackGet(int *num);
473 EWin *const *EwinListFocusGet(int *num);
474 EWin *const *EwinListGetForDesk(int *num, Desk * d);
475 EWin *const *EwinListOrderGet(int *num);
476 EWin *EwinListStackGetTop(void);
477 int EwinListStackIsRaised(const EWin * ewin);
479 #define EwinListGetAll EwinListStackGet
482 EWin *GetZoomEWin(void);
483 void ReZoom(EWin * ewin);
487 void Zoom(EWin * ewin);
489 #endif /* _EWIN_H_ */