2019-01-05 08:15:23 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 Red Hat Inc.
|
|
|
|
* Copyright (C) 2018 Robert Mader
|
|
|
|
*
|
|
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef META_MONITOR_TRANSFORM_H
|
|
|
|
#define META_MONITOR_TRANSFORM_H
|
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
|
|
|
|
#include "backends/meta-backend-types.h"
|
2020-05-04 14:09:28 -04:00
|
|
|
#include "backends/meta-orientation-manager.h"
|
2020-02-18 05:29:24 -05:00
|
|
|
#include "core/util-private.h"
|
2019-01-05 08:15:23 -05:00
|
|
|
|
|
|
|
enum _MetaMonitorTransform
|
|
|
|
{
|
|
|
|
META_MONITOR_TRANSFORM_NORMAL,
|
|
|
|
META_MONITOR_TRANSFORM_90,
|
|
|
|
META_MONITOR_TRANSFORM_180,
|
|
|
|
META_MONITOR_TRANSFORM_270,
|
|
|
|
META_MONITOR_TRANSFORM_FLIPPED,
|
|
|
|
META_MONITOR_TRANSFORM_FLIPPED_90,
|
|
|
|
META_MONITOR_TRANSFORM_FLIPPED_180,
|
|
|
|
META_MONITOR_TRANSFORM_FLIPPED_270,
|
|
|
|
};
|
kms: Add plane representation
A plane is one of three possible: primary, overlay and cursor. Each
plane can have various properties, such as possible rotations, formats
etc. Each plane can also be used with a set of CRTCs.
A primary plane is the "backdrop" of a CRTC, i.e. the primary output for
the composited frame that covers the whole CRTC. In general, mutter
composites to a stage view frame onto a framebuffer that is then put on
the primary plane.
An overlay plane is a rectangular area that can be displayed on top of
the primary plane. Eventually it will be used to place non-fullscreen
surfaces, potentially avoiding stage redraws.
A cursor plane is a plane placed on top of all the other planes, usually
used to put the mouse cursor sprite.
Initially, we only fetch the rotation properties, and we so far
blacklist all rotations except ones that ends up with the same
dimensions as with no rotations. This is because non-180° rotations
doesn't work yet due to incorrect buffer modifiers. To make it possible
to use non-180° rotations, changes necessary include among other things
finding compatible modifiers using atomic modesetting. Until then,
simply blacklist the ones we know doesn't work.
https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-01-31 12:48:19 -05:00
|
|
|
#define META_MONITOR_N_TRANSFORMS (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)
|
2020-02-26 04:14:52 -05:00
|
|
|
#define META_MONITOR_ALL_TRANSFORMS ((1 << META_MONITOR_N_TRANSFORMS) - 1)
|
2019-01-05 08:15:23 -05:00
|
|
|
|
|
|
|
/* Returns true if transform causes width and height to be inverted
|
|
|
|
This is true for the odd transforms in the enum */
|
|
|
|
static inline gboolean
|
|
|
|
meta_monitor_transform_is_rotated (MetaMonitorTransform transform)
|
|
|
|
{
|
|
|
|
return (transform % 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Returns true if transform involves flipping */
|
|
|
|
static inline gboolean
|
|
|
|
meta_monitor_transform_is_flipped (MetaMonitorTransform transform)
|
|
|
|
{
|
2020-05-05 09:07:02 -04:00
|
|
|
return (transform >= META_MONITOR_TRANSFORM_FLIPPED);
|
2019-01-05 08:15:23 -05:00
|
|
|
}
|
|
|
|
|
2020-05-04 14:09:28 -04:00
|
|
|
META_EXPORT_TEST
|
|
|
|
MetaMonitorTransform meta_monitor_transform_from_orientation (MetaOrientation orientation);
|
|
|
|
|
2020-05-08 20:12:30 -04:00
|
|
|
META_EXPORT_TEST
|
2019-01-05 08:18:02 -05:00
|
|
|
MetaMonitorTransform meta_monitor_transform_invert (MetaMonitorTransform transform);
|
|
|
|
|
2020-02-18 05:29:24 -05:00
|
|
|
META_EXPORT_TEST
|
|
|
|
MetaMonitorTransform meta_monitor_transform_transform (MetaMonitorTransform transform,
|
|
|
|
MetaMonitorTransform other);
|
|
|
|
|
2019-06-24 15:26:31 -04:00
|
|
|
MetaMonitorTransform meta_monitor_transform_relative_transform (MetaMonitorTransform transform,
|
|
|
|
MetaMonitorTransform other);
|
|
|
|
|
2020-03-19 03:59:26 -04:00
|
|
|
void meta_monitor_transform_transform_point (MetaMonitorTransform transform,
|
|
|
|
int area_width,
|
|
|
|
int area_height,
|
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int *out_x,
|
|
|
|
int *out_y);
|
|
|
|
|
2019-01-05 08:15:23 -05:00
|
|
|
#endif /* META_MONITOR_TRANSFORM_H */
|