Add a MetaScreen:restacked signal and expose MetaWindow.layer

Expose restacking and a window's stack layer to allow a compositor
to insert elements into the window stack in the right location.
(See Bug 571827 – hide panel when screensaver is active)

src/core/stack.h src/include/common.h: Move MetaStackLayer to
 a public header.

src/core/screen.c src/core/screen-private.h src/core/stack.c:
 Add a ::restacked signal emitted after we finish restracking.

src/core/window.h src/include/window.h: Add meta_window_get_layer()
This commit is contained in:
Dan Winship 2009-03-12 17:07:27 -04:00
parent 0e256a21a5
commit a47bb96536
7 changed files with 53 additions and 17 deletions

View File

@ -144,6 +144,8 @@ struct _MetaScreen
struct _MetaScreenClass
{
GObjectClass parent_class;
void (*restacked) (MetaScreen *);
};
MetaScreen* meta_screen_new (MetaDisplay *display,
@ -229,4 +231,6 @@ gboolean meta_screen_apply_startup_properties (MetaScreen *screen,
MetaWindow *window);
void meta_screen_composite_all_windows (MetaScreen *screen);
void meta_screen_restacked (MetaScreen *screen);
#endif

View File

@ -74,6 +74,15 @@ enum
PROP_N_WORKSPACES = 1
};
enum
{
RESTACKED,
LAST_SIGNAL
};
static guint screen_signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (MetaScreen, meta_screen, G_TYPE_OBJECT);
static void
@ -129,6 +138,15 @@ meta_screen_class_init (MetaScreenClass *klass)
object_class->set_property = meta_screen_set_property;
object_class->finalize = meta_screen_finalize;
screen_signals[RESTACKED] =
g_signal_new ("restacked",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (MetaScreenClass, restacked),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
pspec = g_param_spec_int ("n-workspaces",
"N Workspaces",
"Number of workspaces",
@ -2997,3 +3015,9 @@ meta_screen_get_active_workspace (MetaScreen *screen)
{
return screen->active_workspace;
}
void
meta_screen_restacked (MetaScreen *screen)
{
g_signal_emit (screen, screen_signals[RESTACKED], 0);
}

View File

@ -1287,6 +1287,8 @@ stack_sync_to_server (MetaStack *stack)
g_array_free (stack->last_root_children_stacked, TRUE);
stack->last_root_children_stacked = root_children_stacked;
meta_screen_restacked (stack->screen);
/* That was scary... */
}

View File

@ -43,23 +43,6 @@
#include "screen-private.h"
/**
* Layers a window can be in.
* These MUST be in the order of stacking.
*/
typedef enum
{
META_LAYER_DESKTOP = 0,
META_LAYER_BOTTOM = 1,
META_LAYER_NORMAL = 2,
META_LAYER_TOP = 4, /* Same as DOCK; see EWMH and bug 330717 */
META_LAYER_DOCK = 4,
META_LAYER_FULLSCREEN = 5,
META_LAYER_FOCUSED_WINDOW = 6,
META_LAYER_OVERRIDE_REDIRECT = 7,
META_LAYER_LAST = 8
} MetaStackLayer;
/**
* A sorted list of windows bearing some level of resemblance to the stack of
* windows on the X server.

View File

@ -8673,3 +8673,8 @@ meta_window_get_role (MetaWindow *window)
return window->role;
}
MetaStackLayer
meta_window_get_layer (MetaWindow *window)
{
return window->layer;
}

View File

@ -289,4 +289,21 @@ struct _MetaButtonLayout
(ycoord) >= (rect).y && \
(ycoord) < ((rect).y + (rect).height))
/**
* Layers a window can be in.
* These MUST be in the order of stacking.
*/
typedef enum
{
META_LAYER_DESKTOP = 0,
META_LAYER_BOTTOM = 1,
META_LAYER_NORMAL = 2,
META_LAYER_TOP = 4, /* Same as DOCK; see EWMH and bug 330717 */
META_LAYER_DOCK = 4,
META_LAYER_FULLSCREEN = 5,
META_LAYER_FOCUSED_WINDOW = 6,
META_LAYER_OVERRIDE_REDIRECT = 7,
META_LAYER_LAST = 8
} MetaStackLayer;
#endif

View File

@ -97,6 +97,7 @@ GObject *meta_window_get_compositor_private (MetaWindow *window);
void meta_window_set_compositor_private (MetaWindow *window, GObject *priv);
void meta_window_configure_notify (MetaWindow *window, XConfigureEvent *event);
const char *meta_window_get_role (MetaWindow *window);
MetaStackLayer meta_window_get_layer (MetaWindow *window);
MetaWindow* meta_window_find_root_ancestor (MetaWindow *window);
#endif