Subversion Repositories WindowManager

Rev

Blame | Last modification | View Log | RSS feed

// This file is part of the free Window Manager module.
// Copyright © 2007 Graham Shaw.
// Redistribution and modification are permitted within the terms of the
// GNU General Public License (version 2 or any later version).

#ifndef WINDOWMANAGER_OS_COORD
#define WINDOWMANAGER_OS_COORD

#include "oslib/os.h"

/** Construct a point from its coordinates.
 * @param x the x coordinate
 * @param y the y coordinate
 * @return the constructed point
 */

inline os_coord make_os_coord(int x,int y)
{
        os_coord result;
        result.x=x;
        result.y=y;
        return result;
}

/** Move a point through a given displacement
 * @param lhs the point to be displaced
 * @param rhs the displacement
 * @return the displaced point
 */

inline os_coord operator+(const os_coord& lhs,const os_coord& rhs)
{
        os_coord result;
        result.x=lhs.x+rhs.x;
        result.y=lhs.y+rhs.y;
        return result;
}

/** Move a point through the reverse of a given displacement
 * @param lhs the point to be displaced
 * @param rhs the displacement
 * @return the displaced point
 */

inline os_coord operator-(const os_coord& lhs,const os_coord& rhs)
{
        os_coord result;
        result.x=lhs.x-rhs.x;
        result.y=lhs.y-rhs.y;
        return result;
}

#endif