/** * wnck_workspace_is_virtual: * @space: a #WnckWorkspace. * * Gets whether @space contains a viewport. * * Returns: %TRUE if @space contains a viewport, %FALSE otherwise. * * Since: 2.4 */ gboolean wnck_workspace_is_virtual (WnckWorkspace *space) { g_return_val_if_fail (WNCK_IS_WORKSPACE (space), FALSE); return space->priv->is_virtual; }
/** * wnck_workspace_get_layout_column: * @space: a #WnckWorkspace. * * Gets the column of @space in the #WnckWorkspace layout. The first column * has an index of 0 and is always the left column, regardless of the starting * corner set for the layout and regardless of the default direction of the * environment (i.e., in both Left-To-Right and Right-To-Left environments). * * Return value: the column of @space in the #WnckWorkspace layout, or -1 on * errors. * * Since: 2.20 **/ int wnck_workspace_get_layout_column (WnckWorkspace *space) { _WnckLayoutOrientation orientation; _WnckLayoutCorner corner; int n_rows; int n_cols; int col; g_return_val_if_fail (WNCK_IS_WORKSPACE (space), -1); _wnck_screen_get_workspace_layout (space->priv->screen, &orientation, &n_rows, &n_cols, &corner); if (orientation == WNCK_LAYOUT_ORIENTATION_HORIZONTAL) col = space->priv->number % n_cols; else col = space->priv->number / n_rows; if (corner == WNCK_LAYOUT_CORNER_TOPRIGHT || corner == WNCK_LAYOUT_CORNER_BOTTOMRIGHT) col = n_cols - col; return col; }
/** * wnck_workspace_get_height: * @space: a #WnckWorkspace. * * Gets the height of @space. * * Returns: the height of @space. * * Since: 2.4 */ int wnck_workspace_get_height (WnckWorkspace *space) { g_return_val_if_fail (WNCK_IS_WORKSPACE (space), 0); return space->priv->height; }
/** * wnck_workspace_get_viewport_y: * @space: a #WnckWorkspace. * * Gets the Y coordinate of the viewport in @space. * * Returns: the Y coordinate of the viewport in @space, or 0 if @space does not * contain a viewport. * * Since: 2.4 */ int wnck_workspace_get_viewport_y (WnckWorkspace *space) { g_return_val_if_fail (WNCK_IS_WORKSPACE (space), 0); return space->priv->viewport_y; }
/** * wnck_workspace_get_screen: * @space: a #WnckWorkspace. * * Gets the #WnckScreen @space is on. * * Return value: (transfer none): the #WnckScreen @space is on. The returned * #WnckScreen is owned by libwnck and must not be referenced or unreferenced. **/ WnckScreen* wnck_workspace_get_screen (WnckWorkspace *space) { g_return_val_if_fail (WNCK_IS_WORKSPACE (space), NULL); return space->priv->screen; }
/** * wnck_workspace_get_width: * @space: a #WnckWorkspace. * * Gets the width of @space. * * Returns: the width of @space. * * Since: 2.4 */ int wnck_workspace_get_width (WnckWorkspace *space) { g_return_val_if_fail (WNCK_IS_WORKSPACE (space), 0); return space->priv->width; }
/** * wnck_workspace_get_name: * @space: a #WnckWorkspace. * * Gets the human-readable name that should be used to refer to @space. If * the user has not set a special name, a fallback like "Workspace 3" will be * used. * * Return value: the name of @space. **/ const char* wnck_workspace_get_name (WnckWorkspace *space) { g_return_val_if_fail (WNCK_IS_WORKSPACE (space), NULL); return space->priv->name; }
/** * wnck_workspace_get_number: * @space: a #WnckWorkspace. * * Gets the index of @space on the #WnckScreen to which it belongs. The * first workspace has an index of 0. * * Return value: the index of @space on its #WnckScreen, or -1 on errors. **/ int wnck_workspace_get_number (WnckWorkspace *space) { g_return_val_if_fail (WNCK_IS_WORKSPACE (space), -1); return space->priv->number; }
/** * wnck_workspace_activate: * @space: a #WnckWorkspace. * @timestamp: the X server timestamp of the user interaction event that caused * this call to occur. * * Asks the window manager to make @space the active workspace. The window * manager may decide to refuse the request (to not steal the focus if there is * a more recent user activity, for example). * * This function existed before 2.10, but the @timestamp argument was missing * in earlier versions. * * Since: 2.10 **/ void wnck_workspace_activate (WnckWorkspace *space, guint32 timestamp) { g_return_if_fail (WNCK_IS_WORKSPACE (space)); _wnck_activate_workspace (WNCK_SCREEN_XSCREEN (space->priv->screen), space->priv->number, timestamp); }
/** * wnck_workspace_change_name: * @space: a #WnckWorkspace. * @name: new name for @space. * * Changes the name of @space. * * Since: 2.2 **/ void wnck_workspace_change_name (WnckWorkspace *space, const char *name) { g_return_if_fail (WNCK_IS_WORKSPACE (space)); g_return_if_fail (name != NULL); _wnck_screen_change_workspace_name (space->priv->screen, space->priv->number, name); }
static void wnck_workspace_accessible_get_extents (AtkComponent *component, int *x, int *y, int *width, int *height, AtkCoordType coords) { AtkGObjectAccessible *atk_gobj; WnckPager *pager; GdkRectangle rect; GtkWidget *widget; AtkObject *parent; GObject *g_obj; int px, py; g_return_if_fail (WNCK_IS_WORKSPACE_ACCESSIBLE (component)); atk_gobj = ATK_GOBJECT_ACCESSIBLE (component); g_obj = atk_gobject_accessible_get_object (atk_gobj); if (g_obj == NULL) return; g_return_if_fail (WNCK_IS_WORKSPACE (g_obj)); parent = atk_object_get_parent (ATK_OBJECT(component)); #if GTK_CHECK_VERSION(2,21,0) widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (parent)); #else widget = GTK_ACCESSIBLE (parent)->widget; #endif if (widget == NULL) { /* *State is defunct */ return; } g_return_if_fail (WNCK_IS_PAGER (widget)); pager = WNCK_PAGER (widget); g_return_if_fail (WNCK_IS_PAGER (pager)); atk_component_get_position (ATK_COMPONENT (parent), &px,&py, coords); _wnck_pager_get_workspace_rect (pager, WNCK_WORKSPACE_ACCESSIBLE (component)->index, &rect); *x = rect.x + px; *y = rect.y + py; *height = rect.height; *width = rect.width; }
void _wnck_workspace_update_name (WnckWorkspace *space, const char *name) { char *old; g_return_if_fail (WNCK_IS_WORKSPACE (space)); old = space->priv->name; space->priv->name = g_strdup (name); if (space->priv->name == NULL) space->priv->name = g_strdup_printf (_("Workspace %d"), space->priv->number + 1); if ((old && !name) || (!old && name) || (old && name && strcmp (old, name) != 0)) emit_name_changed (space); g_free (old); }
static gboolean on_task_item_button_released (GtkWidget *widget, GdkEventButton *event, TaskItem *item) { WnckWindow *window; WnckScreen *screen; WnckWorkspace *workspace; TaskItemPrivate *priv; g_return_val_if_fail (TASK_IS_ITEM (item), TRUE); priv = item->priv; window = priv->window; g_return_val_if_fail (WNCK_IS_WINDOW (window), TRUE); screen = priv->screen; workspace = wnck_window_get_workspace (window); if (event->button == 1) { if (WNCK_IS_WORKSPACE (workspace) && workspace != wnck_screen_get_active_workspace (screen)) { wnck_workspace_activate (workspace, GDK_CURRENT_TIME); } if (wnck_window_is_active (window)) { wnck_window_minimize (window); } else { wnck_window_activate (window, GDK_CURRENT_TIME); } } return TRUE; }
/** * wnck_workspace_get_neighbor: * @space: a #WnckWorkspace. * @direction: direction in which to search the neighbor. * * Gets the neighbor #WnckWorkspace of @space in the @direction direction. * * Return value: (transfer none): the neighbor #WnckWorkspace of @space in the * @direction direction, or %NULL if no such neighbor #WnckWorkspace exists. * The returned #WnckWorkspace is owned by libwnck and must not be referenced * or unreferenced. * * Since: 2.20 **/ WnckWorkspace* wnck_workspace_get_neighbor (WnckWorkspace *space, WnckMotionDirection direction) { _WnckLayoutOrientation orientation; _WnckLayoutCorner corner; int n_rows; int n_cols; int row; int col; int add; int index; g_return_val_if_fail (WNCK_IS_WORKSPACE (space), NULL); _wnck_screen_get_workspace_layout (space->priv->screen, &orientation, &n_rows, &n_cols, &corner); row = wnck_workspace_get_layout_row (space); col = wnck_workspace_get_layout_column (space); index = space->priv->number; switch (direction) { case WNCK_MOTION_LEFT: if (col == 0) return NULL; if (orientation == WNCK_LAYOUT_ORIENTATION_HORIZONTAL) add = 1; else add = n_rows; if (corner == WNCK_LAYOUT_CORNER_TOPRIGHT || corner == WNCK_LAYOUT_CORNER_BOTTOMRIGHT) index += add; else index -= add; break; case WNCK_MOTION_RIGHT: if (col == n_cols - 1) return NULL; if (orientation == WNCK_LAYOUT_ORIENTATION_HORIZONTAL) add = 1; else add = n_rows; if (corner == WNCK_LAYOUT_CORNER_TOPRIGHT || corner == WNCK_LAYOUT_CORNER_BOTTOMRIGHT) index -= add; else index += add; break; case WNCK_MOTION_UP: if (row == 0) return NULL; if (orientation == WNCK_LAYOUT_ORIENTATION_HORIZONTAL) add = n_cols; else add = 1; if (corner == WNCK_LAYOUT_CORNER_BOTTOMLEFT || corner == WNCK_LAYOUT_CORNER_BOTTOMRIGHT) index += add; else index -= add; break; case WNCK_MOTION_DOWN: if (row == n_rows - 1) return NULL; if (orientation == WNCK_LAYOUT_ORIENTATION_HORIZONTAL) add = n_cols; else add = 1; if (corner == WNCK_LAYOUT_CORNER_BOTTOMLEFT || corner == WNCK_LAYOUT_CORNER_BOTTOMRIGHT) index -= add; else index += add; break; } if (index == space->priv->number) return NULL; return wnck_screen_get_workspace (space->priv->screen, index); }