/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ /* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2002, 2003, 2004 Red Hat, Inc. * Copyright (C) 2003, 2004 Rob Adams * Copyright (C) 2004-2006 Elijah Newren * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ #ifndef META_WORKSPACE_MANAGER_PRIVATE_H #define META_WORKSPACE_MANAGER_PRIVATE_H #include #include "core/display-private.h" #include "meta/common.h" #include "meta/types.h" #include "meta/meta-workspace-manager.h" // // Stores list of MetaWorkspaces and pointer to an active MetaWorkspace. When this context becomes // the current context, the workspace fields are swapped into the corresponding fields in // MetaWorkspaceManager. // // struct _MetaWorkspaceContext { GObject parent; // Link back to MetaWorkspaceManager MetaWorkspaceManager *manager; // MetaWorkspace list belonging to this context. Copied to field with same name in // MetaWorkspaceManager when this context is active. Any code which changes this list // must make sure this context is not currently active in which case the list in // MetaWorkspaceManager must be changed instead. GList *workspaces; // Active MetaWorkspace for this context. Also copied to workspace manager upon activation. // The rule above about not writing if context is currently active also applies to this field. MetaWorkspace *active_workspace; // PID namespace gchar *namespace; // A unique ID value for this context. guint id; }; struct _MetaWorkspaceManager { GObject parent; MetaDisplay *display; MetaWorkspace *active_workspace; GList *all_workspaces; GList *workspaces; // List of WorkspaceContext GList *context_list; gchar *mutter_namespace; // Current active WorkspaceContext. MetaWorkspaceManager state (workspaces, active_workspace) // will be saved here when a new WorkspaceContext is made active. MetaWorkspaceContext *active_context; // The next id value to allocate when creating a new WorkspaceContext guint next_context_id; int rows_of_workspaces; int columns_of_workspaces; MetaDisplayCorner starting_corner; guint vertical_workspaces : 1; guint workspace_layout_overridden : 1; }; MetaWorkspaceManager *meta_workspace_manager_new (MetaDisplay *display); void meta_workspace_manager_init_workspaces (MetaWorkspaceManager *workspace_manager); void meta_workspace_manager_update_workspace_layout (MetaWorkspaceManager *workspace_manager, MetaDisplayCorner starting_corner, gboolean vertical_layout, int n_rows, int n_columns); void meta_workspace_manager_reload_work_areas (MetaWorkspaceManager *workspace_manager); typedef struct MetaWorkspaceLayout MetaWorkspaceLayout; struct MetaWorkspaceLayout { int rows; int cols; int *grid; int grid_area; int current_row; int current_col; }; void meta_workspace_manager_calc_workspace_layout (MetaWorkspaceManager *workspace_manager, int num_workspaces, int current_space, MetaWorkspaceLayout *layout); void meta_workspace_manager_free_workspace_layout (MetaWorkspaceLayout *layout); void meta_workspace_manager_minimize_all_on_active_workspace_except (MetaWorkspaceManager *workspace_manager, MetaWindow *keep); /* Show/hide the desktop (temporarily hide all windows) */ void meta_workspace_manager_show_desktop (MetaWorkspaceManager *workspace_manager, guint32 timestamp); void meta_workspace_manager_unshow_desktop (MetaWorkspaceManager *workspace_manager); void meta_workspace_manager_workspace_switched (MetaWorkspaceManager *workspace_manager, int from, int to, MetaMotionDirection direction); void meta_workspace_manager_update_num_workspaces (MetaWorkspaceManager *workspace_manager, guint32 timestamp, int new_num); MetaWorkspaceContext *meta_workspace_context_new (MetaWorkspaceManager *manager, const char *namespace); void meta_workspace_context_make_active (MetaWorkspaceContext *context); MetaWorkspaceContext *meta_workspace_manager_lookup_context (MetaWorkspaceManager *workspace_manager, guint context_id); void meta_workspace_manager_append_context_workspace (MetaWorkspaceManager *manager, MetaWorkspace *workspace); void meta_workspace_manager_remove_context_workspace (MetaWorkspaceManager *manager, MetaWorkspace *workspace); int meta_workspace_manager_context_workspace_index (MetaWorkspaceManager *workspace_manager, MetaWorkspace *workspace); int meta_workspace_manager_get_workspace_id (MetaWorkspaceManager *workspace_manager, MetaWorkspace *workspace); MetaWorkspace * meta_workspace_manager_lookup_workspace_by_id (MetaWorkspaceManager *workspace_manager, int workspace_id); gboolean meta_workspace_manager_is_window_on_foreign_context (MetaWorkspaceManager *workspace_manager, MetaWindow *window); #endif /* META_WORKSPACE_MANAGER_PRIVATE_H */