mirror of
https://github.com/brl/mutter.git
synced 2024-11-13 01:36:10 -05:00
workspace: Add a "workspace-index" property to MetaWorkspace
This will be used to replace some of the hooks that are used to call into window.c, so that the workspace index property is properly kept up to date. We can't name the property "index" since it causes conflicts with the meta_workspace_index method. This should really be called meta_workspace_get_index, but oh well.
This commit is contained in:
parent
1999fcaa8f
commit
19795c1681
@ -1122,7 +1122,7 @@ meta_screen_remove_workspace (MetaScreen *screen, MetaWorkspace *workspace,
|
||||
for (l = next; l != NULL; l = l->next)
|
||||
{
|
||||
MetaWorkspace *w = l->data;
|
||||
meta_workspace_update_window_hints (w);
|
||||
meta_workspace_index_changed (w);
|
||||
}
|
||||
|
||||
meta_screen_queue_workarea_recalc (screen);
|
||||
|
@ -94,4 +94,6 @@ void meta_workspace_focus_default_window (MetaWorkspace *workspace,
|
||||
|
||||
const char* meta_workspace_get_name (MetaWorkspace *workspace);
|
||||
|
||||
void meta_workspace_index_changed (MetaWorkspace *workspace);
|
||||
|
||||
#endif
|
||||
|
@ -60,6 +60,7 @@ enum {
|
||||
PROP_0,
|
||||
|
||||
PROP_N_WINDOWS,
|
||||
PROP_WORKSPACE_INDEX,
|
||||
|
||||
LAST_PROP,
|
||||
};
|
||||
@ -114,6 +115,9 @@ meta_workspace_get_property (GObject *object,
|
||||
*/
|
||||
g_value_set_uint (value, g_list_length (ws->windows));
|
||||
break;
|
||||
case PROP_WORKSPACE_INDEX:
|
||||
g_value_set_uint (value, meta_workspace_index (ws));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -148,6 +152,11 @@ meta_workspace_class_init (MetaWorkspaceClass *klass)
|
||||
"Number of windows",
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
obj_props[PROP_WORKSPACE_INDEX] = g_param_spec_uint ("workspace-index",
|
||||
"Workspace index",
|
||||
"The workspace's index",
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, LAST_PROP, obj_props);
|
||||
}
|
||||
@ -691,7 +700,7 @@ meta_workspace_index (MetaWorkspace *workspace)
|
||||
}
|
||||
|
||||
void
|
||||
meta_workspace_update_window_hints (MetaWorkspace *workspace)
|
||||
meta_workspace_index_changed (MetaWorkspace *workspace)
|
||||
{
|
||||
GList *l;
|
||||
for (l = workspace->windows; l != NULL; l = l->next)
|
||||
@ -699,6 +708,8 @@ meta_workspace_update_window_hints (MetaWorkspace *workspace)
|
||||
MetaWindow *win = l->data;
|
||||
meta_window_current_workspace_changed (win);
|
||||
}
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (workspace), obj_props[PROP_WORKSPACE_INDEX]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,7 +49,6 @@ void meta_workspace_activate_with_focus (MetaWorkspace *workspace,
|
||||
MetaWindow *focus_this,
|
||||
guint32 timestamp);
|
||||
|
||||
void meta_workspace_update_window_hints (MetaWorkspace *workspace);
|
||||
void meta_workspace_set_builtin_struts (MetaWorkspace *workspace,
|
||||
GSList *struts);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user