1 /* Copyright (c) 2008 Vincent Povirk
3 Permission is hereby granted, free of charge, to any person
4 obtaining a copy of this software and associated documentation
5 files (the "Software"), to deal in the Software without
6 restriction, including without limitation the rights to use,
7 copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the
9 Software is furnished to do so, subject to the following
12 The above copyright notice and this permission notice shall be
13 included in all copies or substantial portions of the Software.
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 OTHER DEALINGS IN THE SOFTWARE.
25 #ifndef LUCCA_DISPLAY_H
26 #define LUCCA_DISPLAY_H
28 /* Public declarations for the X Window Management Module */
31 #include <glib-object.h>
35 #include "lucca-common.h"
37 /* definition of LuccaType macros */
38 /* FIXME: this should probably be defined somewhere else or moved out of lucca-common.h; actual type registration requires an object file, not just a header */
39 #define LUCCA_TYPE_TYPE lucca_type_get_type()
40 #define LUCCA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LUCCA_TYPE_TYPE, LuccaType))
41 #define LUCCA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LUCCA_TYPE_TYPE, LuccaType))
42 #define LUCCA_IS_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LUCCA_TYPE_TYPE))
43 #define LUCCA_IS_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LUCCA_TYPE_TYPE))
44 #define LUCCA_TYPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LUCCA_TYPE_TYPE, LuccaType))
46 GType
lucca_type_get_type();
48 /* Boiler-plate definition of LuccaDisplay */
49 #define LUCCA_TYPE_DISPLAY lucca_display_get_type()
50 #define LUCCA_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LUCCA_TYPE_DISPLAY, LuccaDisplay))
51 #define LUCCA_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LUCCA_TYPE_DISPLAY, LuccaDisplayClass))
52 #define LUCCA_IS_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LUCCA_TYPE_DISPLAY))
53 #define LUCCA_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LUCCA_TYPE_DISPLAY))
54 #define LUCCA_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LUCCA_TYPE_DISPLAY, LuccaDisplayClass))
56 typedef struct _LuccaDisplay LuccaDisplay
;
57 typedef struct _LuccaDisplayClass LuccaDisplayClass
;
59 GType
lucca_display_get_type();
61 /* Boiler-plate definition of LuccaScreen */
62 #define LUCCA_TYPE_SCREEN lucca_screen_get_type()
63 #define LUCCA_SCREEN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LUCCA_TYPE_SCREEN, LuccaScreen))
64 #define LUCCA_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LUCCA_TYPE_SCREEN, LuccaScreenClass))
65 #define LUCCA_IS_SCREEN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LUCCA_TYPE_SCREEN))
66 #define LUCCA_IS_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LUCCA_TYPE_SCREEN))
67 #define LUCCA_SCREEN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LUCCA_TYPE_SCREEN, LuccaScreenClass))
69 typedef struct _LuccaScreen LuccaScreen
;
70 typedef struct _LuccaScreenClass LuccaScreenClass
;
72 GType
lucca_screen_get_type();
74 /* Boiler-plate definition of LuccaWindow */
75 #define LUCCA_TYPE_WINDOW lucca_window_get_type()
76 #define LUCCA_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LUCCA_TYPE_WINDOW, LuccaWindow))
77 #define LUCCA_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LUCCA_TYPE_WINDOW, LuccaWindowClass))
78 #define LUCCA_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LUCCA_TYPE_WINDOW))
79 #define LUCCA_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LUCCA_TYPE_WINDOW))
80 #define LUCCA_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LUCCA_TYPE_WINDOW, LuccaWindowClass))
82 typedef struct _LuccaWindow LuccaWindow
;
83 typedef struct _LuccaWindowClass LuccaWindowClass
;
85 GType
lucca_window_get_type();
87 /* error constants: */
88 #define LUCCA_DISPLAY_ERROR lucca_display_error_quark()
89 GQuark
lucca_display_error_quark();
91 LUCCA_DISPLAY_ERROR_EXISTINGWM
,
94 /* LuccaDisplay method definitions */
96 /* lucca_display_connect: take over as window manager of a display */
97 void lucca_display_connect(LuccaDisplay
* lucca_display
, GdkDisplay
* display
, const gchar
* name
, GError
** error
);
99 /* lucca_display_disconnect: stop managing a display */
100 void lucca_display_disconnect(LuccaDisplay
* lucca_display
);
102 /* lucca_display_get_default_screen: returns the default screen of a display */
103 LuccaScreen
* lucca_display_get_default_screen(LuccaDisplay
* display
);
105 /* lucca_display_get_windows: return a new GList containing all valid LuccaWindow's for this display; */
106 GList
* lucca_display_get_windows(LuccaDisplay
* display
);
108 /* lucca_display_create_internal: create a new internal window on the display */
109 LuccaWindow
* lucca_display_create_internal(LuccaDisplay
* display
);
111 /* lucca_display_add_hotkey: grab a key and call callback when it is pressed */
112 void lucca_display_add_hotkey(LuccaDisplay
* display
, guint keyval
, GdkModifierType modifiers
, GClosure
* callback
);
114 /* LuccaScreen method definitions */
116 /* lucca_screen_get_display: returns the LuccaDisplay that created a screen */
117 LuccaDisplay
* lucca_screen_get_display(LuccaScreen
* screen
);
119 /* lucca_screen_get_root: returns the root window of a screen */
120 GdkWindow
* lucca_screen_get_root(LuccaScreen
* screen
);
122 /* lucca_screen_dock_window: attempts to dock the window to a screen edge and returns TRUE if it succeeds */
123 gboolean
lucca_screen_dock_window(LuccaScreen
* screen
, LuccaWindow
* window
);
125 /* LuccaWindow method definitions */
127 /* lucca_window_get_geometry_hints: gets the geometry hints of a window */
128 void lucca_window_get_geometry_hints(LuccaWindow
* window
, GdkGeometry
* geometry
, GdkWindowHints
* geom_mask
);
130 /* lucca_window_get_requested_states: gets the set of requested states for the window */
131 LuccaState
lucca_window_get_requested_states(LuccaWindow
* window
);
133 /* lucca_window_set_states: set the "state" of the window */
134 void lucca_window_set_states(LuccaWindow
* window
, LuccaState states
);
136 /* lucca_window_configure: map a window with the specified parent, size, and position or hide the window */
137 void lucca_window_configure(LuccaWindow
* window
, GdkWindow
* parent
, gint x
, gint y
, gint width
, gint height
, gboolean visible
);
139 /* lucca_window_change_owner: become the "owner" of a window and call the previous owner's callback */
140 void lucca_window_change_owner(LuccaWindow
* window
, GClosure
* callback
);
142 /* lucca_window_close: ask the application that owns this window to close it */
143 void lucca_window_close(LuccaWindow
* window
);
145 /* lucca_window_focus: give a window the focus */
146 void lucca_window_give_focus(LuccaWindow
* window
);
148 /* lucca_window_withdraw: hide a window and stop managing it */
149 void lucca_window_withdraw(LuccaWindow
* window
);
151 /* lucca_window_transient_for: returns a list of LuccaWindow's that this window should be above */
152 GList
* lucca_window_transient_for(LuccaWindow
* window
);