示例#1
0
/**
 * Stops moving a window, and fixes its position.
 */
void ClientModel::stop_moving(Window client, Dimension2D location)
{
    Desktop* old_desktop = m_desktops.get_category_of(client);
    if (!old_desktop->is_moving_desktop())
        return;

    if (m_was_stuck[client])
        move_to_desktop(client, ALL_DESKTOPS, false);
    else
        move_to_desktop(client, m_current_desktop, false);

    change_location(client, DIM2D_X(location), DIM2D_Y(location));

    focus(client);
}
示例#2
0
/* Party movement to/from dungeon or to moongate. Repeated until everyone has
 * entered, then the entire party is moved to the destination, and this waits
 * until the visual effects complete.
 */
void TimedPartyMove::timed(uint32 evtime)
{
    if(wait_for_effect != 0) // ignores "falling_in"
    {
        repeat(); // repeat once more (callback() must call stop())
        return;
    }
    stop(); // cancelled further down with repeat(), if still moving

    if(moves_left)
    {
        if(((falling_in == false) && move_party())
                || ((falling_in == true) && fall_in()))
            repeat(); // still moving
    }
    else // timed out, make sure nobody is walking
        for(uint32 m = 0; m < party->get_party_size(); m++)
            party->get_actor(m)->delete_pathfinder();

    // NOTE: set by repeat() or stop()
    if(repeat_count == 0) // everyone is in position
    {
        if(falling_in == false) // change location, get in formation
        {
            change_location(); // fade map, move and show party
            party->stop_walking(true); // return control (and change viewpoint)

            // wait for effect or line up now; Party called unpause_user()
            Game::get_game()->pause_user();
            if(wait_for_effect == 0)
            {
                delay = 50;
                set_time(); // fall-in as fast as possible (but visibly)
                moves_left = party->get_party_size() - 1; // followers
                falling_in = true;
            }
            repeat(); // don't stop yet!
        }
        else // already changed location
        {
            Game::get_game()->unpause_user();
            stop_timer(); // done
        }
    }
    if(moves_left > 0)
        --moves_left;
}
示例#3
0
/**
 * Repacks the clients at the given corner.
 */
void ClientModel::repack_corner(PackCorner corner)
{
    // We only need X because SmallWM doesn't currently support the vertical
    // packing case
    int x_incr_sign;
    int x_coord, y_coord;

    // For east/south side packings, we have to subtract the width/height of
    // the window from the current coordinate
    bool subtract_width_first, subtract_height_first;

    const Box &screen = get_root_screen();

    switch (corner)
    {
    case PACK_NORTHWEST:
        x_incr_sign = 1;
        subtract_width_first = false;
        subtract_height_first = false;
        x_coord = screen.x;
        y_coord = screen.y;
        break;
    case PACK_NORTHEAST:
        x_incr_sign = -1;
        subtract_width_first = true;
        subtract_height_first = false;
        x_coord = screen.width;
        y_coord = screen.y;
        break;
    case PACK_SOUTHWEST:
        x_incr_sign = 1;
        subtract_width_first = false;
        subtract_height_first = true;
        x_coord = 0;
        y_coord = screen.height;
        break;
    case PACK_SOUTHEAST:
        x_incr_sign = -1;
        subtract_width_first = true;
        subtract_height_first = true;
        x_coord = screen.width;
        y_coord = screen.height;
        break;
    }

    // We need to collect all the windows so that we can sort them by layout
    // order (low priority closest to the corner, higher priority farther
    // away)
    std::vector<Window> windows_on_this_corner;
    for (std::map<Window, PackCorner>::iterator iter = m_pack_corners.begin();
         iter != m_pack_corners.end();
         iter++)
    {
        if (iter->second == corner)
            windows_on_this_corner.push_back(iter->first);
    }

    MapSorter<Window, unsigned long> sorter(m_pack_priority);
    std::sort(windows_on_this_corner.begin(),
              windows_on_this_corner.end(),
              sorter);

    Dimension border = m_border_width * 2;
    for (std::vector<Window>::iterator iter = windows_on_this_corner.begin();
         iter != windows_on_this_corner.end();
         iter++)
    {
        Dimension2D &size = m_size[*iter];

        int real_x, real_y;
        if (subtract_width_first)
            real_x = x_coord - (DIM2D_WIDTH(size) + border);
        else
            real_x = x_coord;

        if (subtract_height_first)
            real_y = y_coord - (DIM2D_HEIGHT(size) + border);
        else
            real_y = y_coord;

        change_location(*iter, real_x, real_y);
        x_coord += x_incr_sign * (DIM2D_WIDTH(size) + border);
    }
}
示例#4
0
	    /// setup an object when read from an archive
	    ///
	    /// \param[in] pdesc points to an existing stack that will be read from to setup fields of inherited classes,
	    /// this pointed to pile object must survive the whole life of the cat_entree object
	    /// \param[in] small whether a small or a whole read is to be read, (inode has been dump() with small set to true)
	cat_entree(const pile_descriptor & pdesc, bool small) { change_location(pdesc, small); };