]> icculus.org git repositories - mikachu/openbox.git/blob - openbox/focus.h
i rewrote handling of focus events. this is pretty much based on blackbox's current...
[mikachu/openbox.git] / openbox / focus.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3    focus.h for the Openbox window manager
4    Copyright (c) 2006        Mikael Magnusson
5    Copyright (c) 2003        Ben Jansens
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    See the COPYING file for a copy of the GNU General Public License.
18 */
19
20 #ifndef __focus_h
21 #define __focus_h
22
23 #include "misc.h"
24
25 #include <X11/Xlib.h>
26 #include <glib.h>
27
28 struct _ObClient;
29
30 /*! The client which is currently focused */
31 extern struct _ObClient *focus_client;
32 /*! The client which is being decorated as focused, not always matching the
33   real focus, but this is used to track it so that it can be resolved to match
34 */
35 extern struct _ObClient *focus_hilite;
36 /*! The client which appears focused during a focus cycle operation */
37 extern struct _ObClient *focus_cycle_target;
38
39 /*! The recent focus order on each desktop */
40 extern GList **focus_order;
41
42 void focus_startup(gboolean reconfig);
43 void focus_shutdown(gboolean reconfig);
44
45 /*! Specify which client is currently focused, this doesn't actually
46   send focus anywhere, its called by the Focus event handlers */
47 void focus_set_client(struct _ObClient *client);
48
49 typedef enum {
50     OB_FOCUS_FALLBACK_UNFOCUSING, /*!< forcefully remove focus from the
51                                     current window */
52     OB_FOCUS_FALLBACK_CLOSED,     /*!< closed the window with focus */
53     OB_FOCUS_FALLBACK_NOFOCUS     /*!< nothing has focus for some reason */
54 } ObFocusFallbackType;
55
56 struct _ObClient* focus_fallback_target(ObFocusFallbackType type);
57
58 /*! Call this when you need to focus something! */
59 void focus_fallback(ObFocusFallbackType type);
60
61 /*! Cycle focus amongst windows. */
62 void focus_cycle(gboolean forward, gboolean linear, gboolean interactive,
63                  gboolean dialog, gboolean done, gboolean cancel, Time time);
64 void focus_directional_cycle(ObDirection dir, gboolean interactive,
65                              gboolean dialog, gboolean done, gboolean cancel,
66                              Time time);
67 void focus_cycle_draw_indicator();
68
69 /*! Add a new client into the focus order */
70 void focus_order_add_new(struct _ObClient *c);
71
72 /*! Remove a client from the focus order */
73 void focus_order_remove(struct _ObClient *c);
74
75 /*! Move a client to the top of the focus order */
76 void focus_order_to_top(struct _ObClient *c);
77
78 /*! Move a client to the bottom of the focus order (keeps iconic windows at the
79   very bottom always though). */
80 void focus_order_to_bottom(struct _ObClient *c);
81
82 #endif