mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
monitor-manager: Add API to get scales supported by the backend
For the Xrandr backend, only scale 1 is supported, for the others, 1 and 2 are reported as supported. https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
parent
3b46345db4
commit
9e8ee491e6
@ -39,6 +39,11 @@
|
||||
#define MAX_CRTCS (MAX_MONITORS * 2)
|
||||
#define MAX_MODES (MAX_MONITORS * 4)
|
||||
|
||||
static float supported_scales_dummy[] = {
|
||||
1.0,
|
||||
2.0
|
||||
};
|
||||
|
||||
struct _MetaMonitorManagerDummy
|
||||
{
|
||||
MetaMonitorManager parent_instance;
|
||||
@ -585,6 +590,15 @@ meta_monitor_manager_dummy_calculate_monitor_mode_scale (MetaMonitorManager *man
|
||||
return output_dummy->scale;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_dummy_get_supported_scales (MetaMonitorManager *manager,
|
||||
float **scales,
|
||||
int *n_scales)
|
||||
{
|
||||
*scales = supported_scales_dummy;
|
||||
*n_scales = G_N_ELEMENTS (supported_scales_dummy);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_dummy_class_init (MetaMonitorManagerDummyClass *klass)
|
||||
{
|
||||
@ -596,6 +610,7 @@ meta_monitor_manager_dummy_class_init (MetaMonitorManagerDummyClass *klass)
|
||||
manager_class->apply_configuration = meta_monitor_manager_dummy_apply_config;
|
||||
manager_class->is_transform_handled = meta_monitor_manager_dummy_is_transform_handled;
|
||||
manager_class->calculate_monitor_mode_scale = meta_monitor_manager_dummy_calculate_monitor_mode_scale;
|
||||
manager_class->get_supported_scales = meta_monitor_manager_dummy_get_supported_scales;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -353,6 +353,10 @@ struct _MetaMonitorManagerClass
|
||||
int (*calculate_monitor_mode_scale) (MetaMonitorManager *,
|
||||
MetaMonitor *,
|
||||
MetaMonitorMode *);
|
||||
|
||||
void (*get_supported_scales) (MetaMonitorManager *,
|
||||
float **,
|
||||
int *);
|
||||
};
|
||||
|
||||
void meta_monitor_manager_rebuild (MetaMonitorManager *manager,
|
||||
|
@ -52,6 +52,11 @@
|
||||
#define ALL_TRANSFORMS_MASK ((1 << ALL_TRANSFORMS) - 1)
|
||||
#define SYNC_TOLERANCE 0.01 /* 1 percent */
|
||||
|
||||
static float supported_scales_kms[] = {
|
||||
1.0,
|
||||
2.0
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
drmModeConnector *connector;
|
||||
@ -1904,6 +1909,15 @@ meta_monitor_manager_kms_calculate_monitor_mode_scale (MetaMonitorManager *manag
|
||||
return compute_scale (monitor, monitor_mode);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_kms_get_supported_scales (MetaMonitorManager *manager,
|
||||
float **scales,
|
||||
int *n_scales)
|
||||
{
|
||||
*scales = supported_scales_kms;
|
||||
*n_scales = G_N_ELEMENTS (supported_scales_kms);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_kms_dispose (GObject *object)
|
||||
{
|
||||
@ -1945,4 +1959,5 @@ meta_monitor_manager_kms_class_init (MetaMonitorManagerKmsClass *klass)
|
||||
manager_class->set_crtc_gamma = meta_monitor_manager_kms_set_crtc_gamma;
|
||||
manager_class->is_transform_handled = meta_monitor_manager_kms_is_transform_handled;
|
||||
manager_class->calculate_monitor_mode_scale = meta_monitor_manager_kms_calculate_monitor_mode_scale;
|
||||
manager_class->get_supported_scales = meta_monitor_manager_kms_get_supported_scales;
|
||||
}
|
||||
|
@ -52,6 +52,10 @@
|
||||
* for the reasoning */
|
||||
#define DPI_FALLBACK 96.0
|
||||
|
||||
static float supported_scales_xrandr[] = {
|
||||
1.0
|
||||
};
|
||||
|
||||
struct _MetaMonitorManagerXrandr
|
||||
{
|
||||
MetaMonitorManager parent_instance;
|
||||
@ -1583,6 +1587,15 @@ meta_monitor_manager_xrandr_calculate_monitor_mode_scale (MetaMonitorManager *ma
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_xrandr_get_supported_scales (MetaMonitorManager *manager,
|
||||
float **scales,
|
||||
int *n_scales)
|
||||
{
|
||||
*scales = supported_scales_xrandr;
|
||||
*n_scales = G_N_ELEMENTS (supported_scales_xrandr);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_xrandr_init (MetaMonitorManagerXrandr *manager_xrandr)
|
||||
{
|
||||
@ -1660,6 +1673,7 @@ meta_monitor_manager_xrandr_class_init (MetaMonitorManagerXrandrClass *klass)
|
||||
#endif
|
||||
manager_class->is_transform_handled = meta_monitor_manager_xrandr_is_transform_handled;
|
||||
manager_class->calculate_monitor_mode_scale = meta_monitor_manager_xrandr_calculate_monitor_mode_scale;
|
||||
manager_class->get_supported_scales = meta_monitor_manager_xrandr_get_supported_scales;
|
||||
|
||||
quark_meta_monitor_xrandr_data =
|
||||
g_quark_from_static_string ("-meta-monitor-xrandr-data");
|
||||
|
@ -23,6 +23,11 @@
|
||||
|
||||
#include "backends/meta-monitor-config-manager.h"
|
||||
|
||||
static float supported_scales_test[] = {
|
||||
1.0,
|
||||
2.0
|
||||
};
|
||||
|
||||
struct _MetaMonitorManagerTest
|
||||
{
|
||||
MetaMonitorManager parent;
|
||||
@ -360,6 +365,15 @@ meta_monitor_manager_test_calculate_monitor_mode_scale (MetaMonitorManager *mana
|
||||
return output_test->scale;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_test_get_supported_scales (MetaMonitorManager *manager,
|
||||
float **scales,
|
||||
int *n_scales)
|
||||
{
|
||||
*scales = supported_scales_test;
|
||||
*n_scales = G_N_ELEMENTS (supported_scales_test);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_test_dispose (GObject *object)
|
||||
{
|
||||
@ -393,4 +407,5 @@ meta_monitor_manager_test_class_init (MetaMonitorManagerTestClass *klass)
|
||||
manager_class->tiled_monitor_removed = meta_monitor_manager_test_tiled_monitor_removed;
|
||||
manager_class->is_transform_handled = meta_monitor_manager_test_is_transform_handled;
|
||||
manager_class->calculate_monitor_mode_scale = meta_monitor_manager_test_calculate_monitor_mode_scale;
|
||||
manager_class->get_supported_scales = meta_monitor_manager_test_get_supported_scales;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user