eis: Add "viewport" interface
A MetaEisViewport represents an absolute region backend by e.g. a pointer device. There are two kinds: a standalone viewport, which corresponds to a viewport that has no neighbours, and a non-standalone, which represents a region of a global coordinate space. The reason for having non-standalone viewports is to allow to mirror the logical monitor layout of a desktop, while the standalone are meant to represent things that are not part of the logical monitor layout. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3228>
This commit is contained in:
parent
12c7c1bffb
commit
271fb86b15
80
src/backends/meta-eis-viewport.c
Normal file
80
src/backends/meta-eis-viewport.c
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Red Hat Inc.
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "backends/meta-eis-viewport.h"
|
||||
|
||||
G_DEFINE_INTERFACE (MetaEisViewport, meta_eis_viewport, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
meta_eis_viewport_default_init (MetaEisViewportInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_eis_viewport_is_standalone (MetaEisViewport *viewport)
|
||||
{
|
||||
return META_EIS_VIEWPORT_GET_IFACE (viewport)->is_standalone (viewport);
|
||||
}
|
||||
|
||||
const char *
|
||||
meta_eis_viewport_get_mapping_id (MetaEisViewport *viewport)
|
||||
{
|
||||
return META_EIS_VIEWPORT_GET_IFACE (viewport)->get_mapping_id (viewport);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_eis_viewport_get_position (MetaEisViewport *viewport,
|
||||
int *out_x,
|
||||
int *out_y)
|
||||
{
|
||||
return META_EIS_VIEWPORT_GET_IFACE (viewport)->get_position (viewport,
|
||||
out_x,
|
||||
out_y);
|
||||
}
|
||||
|
||||
void
|
||||
meta_eis_viewport_get_size (MetaEisViewport *viewport,
|
||||
int *out_width,
|
||||
int *out_height)
|
||||
{
|
||||
META_EIS_VIEWPORT_GET_IFACE (viewport)->get_size (viewport,
|
||||
out_width,
|
||||
out_height);
|
||||
}
|
||||
|
||||
double
|
||||
meta_eis_viewport_get_physical_scale (MetaEisViewport *viewport)
|
||||
{
|
||||
return META_EIS_VIEWPORT_GET_IFACE (viewport)->get_physical_scale (viewport);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_eis_viewport_transform_coordinate (MetaEisViewport *viewport,
|
||||
double x,
|
||||
double y,
|
||||
double *out_x,
|
||||
double *out_y)
|
||||
{
|
||||
return META_EIS_VIEWPORT_GET_IFACE (viewport)->transform_coordinate (viewport,
|
||||
x,
|
||||
y,
|
||||
out_x,
|
||||
out_y);
|
||||
}
|
70
src/backends/meta-eis-viewport.h
Normal file
70
src/backends/meta-eis-viewport.h
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Red Hat Inc.
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#define META_TYPE_EIS_VIEWPORT (meta_eis_viewport_get_type ())
|
||||
G_DECLARE_INTERFACE (MetaEisViewport, meta_eis_viewport,
|
||||
META, EIS_VIEWPORT, GObject)
|
||||
|
||||
struct _MetaEisViewportInterface
|
||||
{
|
||||
GTypeInterface parent_iface;
|
||||
|
||||
gboolean (* is_standalone) (MetaEisViewport *viewport);
|
||||
|
||||
const char * (* get_mapping_id) (MetaEisViewport *viewport);
|
||||
|
||||
gboolean (* get_position) (MetaEisViewport *viewport,
|
||||
int *out_x,
|
||||
int *out_y);
|
||||
|
||||
void (* get_size) (MetaEisViewport *viewport,
|
||||
int *out_width,
|
||||
int *out_height);
|
||||
|
||||
double (* get_physical_scale) (MetaEisViewport *viewport);
|
||||
|
||||
gboolean (* transform_coordinate) (MetaEisViewport *viewport,
|
||||
double x,
|
||||
double y,
|
||||
double *out_x,
|
||||
double *out_y);
|
||||
};
|
||||
|
||||
gboolean meta_eis_viewport_is_standalone (MetaEisViewport *viewport);
|
||||
|
||||
const char * meta_eis_viewport_get_mapping_id (MetaEisViewport *viewport);
|
||||
|
||||
gboolean meta_eis_viewport_get_position (MetaEisViewport *viewport,
|
||||
int *out_x,
|
||||
int *out_y);
|
||||
|
||||
void meta_eis_viewport_get_size (MetaEisViewport *viewport,
|
||||
int *out_width,
|
||||
int *out_height);
|
||||
|
||||
double meta_eis_viewport_get_physical_scale (MetaEisViewport *viewport);
|
||||
|
||||
gboolean meta_eis_viewport_transform_coordinate (MetaEisViewport *viewport,
|
||||
double x,
|
||||
double y,
|
||||
double *out_x,
|
||||
double *out_y);
|
@ -23,6 +23,7 @@
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "backends/meta-backend-types.h"
|
||||
#include "backends/meta-eis-viewport.h"
|
||||
|
||||
typedef enum _MetaEisDeviceTypes
|
||||
{
|
||||
|
@ -544,6 +544,8 @@ if have_remote_desktop
|
||||
'backends/meta-eis.h',
|
||||
'backends/meta-eis-client.c',
|
||||
'backends/meta-eis-client.h',
|
||||
'backends/meta-eis-viewport.c',
|
||||
'backends/meta-eis-viewport.h',
|
||||
'backends/meta-remote-desktop.c',
|
||||
'backends/meta-remote-desktop.h',
|
||||
'backends/meta-remote-desktop-session.c',
|
||||
|
Loading…
Reference in New Issue
Block a user