Ejemplo n.º 1
0
/**
 * wnck_set_default_mini_icon_size:
 * @size: the default size for windows and application mini icons.
 *
 * The default main icon size is %WNCK_DEFAULT_MINI_ICON_SIZE. This function
 * allows to change this value.
 *
 * Since: 2.4.6
 */
void
wnck_set_default_mini_icon_size (gsize size)
{
  int default_screen;
  WnckScreen *screen;
  GList *l;

  default_mini_icon_size = size;

  default_screen = DefaultScreen (_wnck_get_default_display ());
  screen = _wnck_screen_get_existing (default_screen);

  if (WNCK_IS_SCREEN (screen))
    {
      /* Make applications and icons to reload their icons */
      for (l = wnck_screen_get_windows (screen); l; l = l->next)
        {
          WnckWindow *window = WNCK_WINDOW (l->data);
          WnckApplication *application = wnck_window_get_application (window);

          _wnck_window_load_icons (window);

          if (WNCK_IS_APPLICATION (application))
            _wnck_application_load_icons (application);
        }
    }
}
Ejemplo n.º 2
0
static void
workspace_destroyed (WnckScreen    *screen,
		     WnckWorkspace *space,
		     PagerData     *pager)
{
        g_return_if_fail (WNCK_IS_SCREEN (screen));
	update_workspaces_model (pager);
}
Ejemplo n.º 3
0
static void workspace_created(WnckScreen* screen, WnckWorkspace* space, PagerData* pager)
{
	g_return_if_fail(WNCK_IS_SCREEN(screen));

	update_workspaces_model(pager);

	wncklet_connect_while_alive(space, "name_changed", G_CALLBACK(workspace_renamed), pager, pager->properties_dialog);
}
Ejemplo n.º 4
0
/**
 * ww_find_neighbour
 * @screen:
 * @windows:
 * @active:
 * @direction:
 *
 * Return value: The neighbouring window from @windows in the given direction
 *               or %NULL in case no window is found or @active is %NULL
 */
WnckWindow*
ww_find_neighbour (WnckScreen	*screen,
                   GList		*windows,
                   WnckWindow	*active,
                   WwDirection	direction)
{
	WnckWindow	*neighbour;
	GList		*next;
	int			ax, ay, aw, ah; /* active window geometry */
	int			wx, wy; /* geometry for currently checked window */ 
	int			nx, ny; /* geometry of neighbour */
	double		wdist, ndist; /* distance to active window */

	neighbour = NULL;
	
	g_return_val_if_fail (WNCK_IS_SCREEN(screen), NULL);
	
	if (g_list_length(windows) == 0)
    {
		return NULL;
    }
	
	/* If there is no active window, do nothing */
	if (active == NULL
		|| wnck_window_is_skip_tasklist (active)) {
		g_debug ("No active window");
		return NULL;
	}

	nx = ny = 0;
	ndist = 100000;

	wnck_window_get_geometry (active, &ax, &ay, &aw, &ah);
	g_debug("Active window '%s' (%d, %d) @ %d x %d",
	        wnck_window_get_name (active), ax, ay, aw, ah);

	/* Set ax and ay to the center of grav. for active */
	ww_window_center (active, &ax, &ay);
	
	if ( direction == LEFT )
	{
		for ( next = windows; next; next = next->next )
		{
			ww_window_center (WNCK_WINDOW (next->data), &wx, &wy);
			wdist = ww_y_weighted_distance (wx, wy, ax, ay);
			if ( wx < ax )
			{
				if ( wdist < ndist )
				{
					neighbour = WNCK_WINDOW (next->data);
					ndist = wdist;
				}
			} 
		}
	}
	else if ( direction == RIGHT )
	{
		for ( next = windows; next; next = next->next )
		{
			ww_window_center (WNCK_WINDOW (next->data), &wx, &wy);
			wdist = ww_y_weighted_distance (wx, wy, ax, ay);
			if ( wx > ax )
			{
				if ( wdist < ndist )
				{
					neighbour = WNCK_WINDOW (next->data);
					ndist = wdist;
				}
			}
		}
	}
	else if ( direction == DOWN )
	{
		for ( next = windows; next; next = next->next )
		{
			ww_window_center (WNCK_WINDOW (next->data), &wx, &wy);
			wdist = ww_x_weighted_distance (wx, wy, ax, ay);
			if ( wy > ay )
			{
				if ( wdist < ndist )
				{
					neighbour = WNCK_WINDOW (next->data);
					ndist = wdist;
				}
			}
		}
	}
	else if ( direction == UP )
	{
		for ( next = windows; next; next = next->next )
		{
			ww_window_center (WNCK_WINDOW (next->data), &wx, &wy);
			wdist = ww_x_weighted_distance (wx, wy, ax, ay);
			if ( wy < ay )
			{
				if ( wdist < ndist )
				{
					neighbour = WNCK_WINDOW (next->data);
					ndist = wdist;
				}
			}
		}
	}

	if (neighbour)
		g_debug ("Found neighbour '%s'",
		         wnck_window_get_name (neighbour));
	
	return neighbour; 
}