diff --git a/src/backends/meta-monitor-config.c b/src/backends/meta-monitor-config.c index a829daa43..9ccea34a4 100644 --- a/src/backends/meta-monitor-config.c +++ b/src/backends/meta-monitor-config.c @@ -60,7 +60,7 @@ typedef struct { gboolean enabled; MetaRectangle rect; float refresh_rate; - enum wl_output_transform transform; + MetaMonitorTransform transform; gboolean is_primary; gboolean is_presentation; @@ -656,20 +656,20 @@ handle_text (GMarkupParseContext *context, else if (strcmp (parser->output_field, "rotation") == 0) { if (strncmp (text, "normal", text_len) == 0) - parser->output.transform = WL_OUTPUT_TRANSFORM_NORMAL; + parser->output.transform = META_MONITOR_TRANSFORM_NORMAL; else if (strncmp (text, "left", text_len) == 0) - parser->output.transform = WL_OUTPUT_TRANSFORM_90; + parser->output.transform = META_MONITOR_TRANSFORM_90; else if (strncmp (text, "upside_down", text_len) == 0) - parser->output.transform = WL_OUTPUT_TRANSFORM_180; + parser->output.transform = META_MONITOR_TRANSFORM_180; else if (strncmp (text, "right", text_len) == 0) - parser->output.transform = WL_OUTPUT_TRANSFORM_270; + parser->output.transform = META_MONITOR_TRANSFORM_270; else g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, "Invalid rotation type %.*s", (int)text_len, text); } else if (strcmp (parser->output_field, "reflect_x") == 0) parser->output.transform += read_bool (text, text_len, error) ? - WL_OUTPUT_TRANSFORM_FLIPPED : 0; + META_MONITOR_TRANSFORM_FLIPPED : 0; else if (strcmp (parser->output_field, "reflect_y") == 0) { /* FIXME (look at the rotation map in monitor.c) */ @@ -1115,7 +1115,7 @@ make_default_config (MetaMonitorConfig *self, ret->outputs[0].rect.width = outputs[0].preferred_mode->width; ret->outputs[0].rect.height = outputs[0].preferred_mode->height; ret->outputs[0].refresh_rate = outputs[0].preferred_mode->refresh_rate; - ret->outputs[0].transform = WL_OUTPUT_TRANSFORM_NORMAL; + ret->outputs[0].transform = META_MONITOR_TRANSFORM_NORMAL; ret->outputs[0].is_primary = TRUE; return ret; @@ -1167,7 +1167,7 @@ make_default_config (MetaMonitorConfig *self, ret->outputs[j].rect.width = outputs[0].preferred_mode->width; ret->outputs[j].rect.height = outputs[0].preferred_mode->height; ret->outputs[j].refresh_rate = outputs[0].preferred_mode->refresh_rate; - ret->outputs[j].transform = WL_OUTPUT_TRANSFORM_NORMAL; + ret->outputs[j].transform = META_MONITOR_TRANSFORM_NORMAL; ret->outputs[j].is_primary = FALSE; ret->outputs[j].is_presentation = FALSE; } @@ -1202,7 +1202,7 @@ make_default_config (MetaMonitorConfig *self, ret->outputs[i].rect.width = output->preferred_mode->width; ret->outputs[i].rect.height = output->preferred_mode->height; ret->outputs[i].refresh_rate = output->preferred_mode->refresh_rate; - ret->outputs[i].transform = WL_OUTPUT_TRANSFORM_NORMAL; + ret->outputs[i].transform = META_MONITOR_TRANSFORM_NORMAL; ret->outputs[i].is_primary = (output == primary); /* Disable outputs that would go beyond framebuffer limits */ @@ -1250,7 +1250,7 @@ ensure_at_least_one_output (MetaMonitorConfig *self, ret->outputs[i].rect.width = output->preferred_mode->width; ret->outputs[i].rect.height = output->preferred_mode->height; ret->outputs[i].refresh_rate = output->preferred_mode->refresh_rate; - ret->outputs[i].transform = WL_OUTPUT_TRANSFORM_NORMAL; + ret->outputs[i].transform = META_MONITOR_TRANSFORM_NORMAL; ret->outputs[i].is_primary = TRUE; } else @@ -1512,7 +1512,7 @@ meta_monitor_config_save (MetaMonitorConfig *self) output->rect.x, output->rect.y, rotation_map[output->transform & 0x3], - output->transform >= WL_OUTPUT_TRANSFORM_FLIPPED ? "yes" : "no", + output->transform >= META_MONITOR_TRANSFORM_FLIPPED ? "yes" : "no", output->is_primary ? "yes" : "no", output->is_presentation ? "yes" : "no"); } @@ -1621,13 +1621,13 @@ output_supports_mode (MetaOutput *output, } static gboolean -crtc_assignment_assign (CrtcAssignment *assign, - MetaCRTC *crtc, - MetaMonitorMode *mode, - int x, - int y, - enum wl_output_transform transform, - MetaOutput *output) +crtc_assignment_assign (CrtcAssignment *assign, + MetaCRTC *crtc, + MetaMonitorMode *mode, + int x, + int y, + MetaMonitorTransform transform, + MetaOutput *output) { MetaCRTCInfo *info = g_hash_table_lookup (assign->info, crtc); diff --git a/src/backends/meta-monitor-manager-dummy.c b/src/backends/meta-monitor-manager-dummy.c index a9c9928f9..b8684b881 100644 --- a/src/backends/meta-monitor-manager-dummy.c +++ b/src/backends/meta-monitor-manager-dummy.c @@ -27,7 +27,7 @@ #include "meta-monitor-manager-dummy.h" -#define ALL_WL_TRANSFORMS ((1 << (WL_OUTPUT_TRANSFORM_FLIPPED_270 + 1)) - 1) +#define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1) struct _MetaMonitorManagerDummy { @@ -66,8 +66,8 @@ meta_monitor_manager_dummy_read_current (MetaMonitorManager *manager) manager->crtcs[0].rect.width = manager->modes[0].width; manager->crtcs[0].rect.height = manager->modes[0].height; manager->crtcs[0].current_mode = &manager->modes[0]; - manager->crtcs[0].transform = WL_OUTPUT_TRANSFORM_NORMAL; - manager->crtcs[0].all_transforms = ALL_WL_TRANSFORMS; + manager->crtcs[0].transform = META_MONITOR_TRANSFORM_NORMAL; + manager->crtcs[0].all_transforms = ALL_TRANSFORMS; manager->crtcs[0].is_dirty = FALSE; manager->crtcs[0].logical_monitor = NULL; diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c index 16c9666f6..81d47c6ab 100644 --- a/src/backends/meta-monitor-manager.c +++ b/src/backends/meta-monitor-manager.c @@ -477,7 +477,7 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton, GVariantBuilder transforms; g_variant_builder_init (&transforms, G_VARIANT_TYPE ("au")); - for (j = 0; j <= WL_OUTPUT_TRANSFORM_FLIPPED_270; j++) + for (j = 0; j <= META_MONITOR_TRANSFORM_FLIPPED_270; j++) if (crtc->all_transforms & (1 << j)) g_variant_builder_add (&transforms, "u", j); @@ -755,8 +755,8 @@ meta_monitor_manager_handle_apply_configuration (MetaDBusDisplayConfig *skeleto crtc_info->y = 0; } - if (transform < WL_OUTPUT_TRANSFORM_NORMAL || - transform > WL_OUTPUT_TRANSFORM_FLIPPED_270 || + if (transform < META_MONITOR_TRANSFORM_NORMAL || + transform > META_MONITOR_TRANSFORM_FLIPPED_270 || ((crtc->all_transforms & (1 << transform)) == 0)) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, diff --git a/src/backends/meta-monitor-manager.h b/src/backends/meta-monitor-manager.h index fc50224f6..531c445be 100644 --- a/src/backends/meta-monitor-manager.h +++ b/src/backends/meta-monitor-manager.h @@ -42,7 +42,6 @@ #include #include "stack-tracker.h" #include "ui.h" -#include #include "meta-display-config-shared.h" #include "meta-dbus-display-config.h" @@ -60,6 +59,17 @@ typedef struct _MetaMonitorInfo MetaMonitorInfo; typedef struct _MetaCRTCInfo MetaCRTCInfo; typedef struct _MetaOutputInfo MetaOutputInfo; +typedef enum { + 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, +} MetaMonitorTransform; + struct _MetaOutput { /* The CRTC driving this output, NULL if the output is not enabled */ @@ -114,7 +124,7 @@ struct _MetaCRTC glong crtc_id; MetaRectangle rect; MetaMonitorMode *current_mode; - enum wl_output_transform transform; + MetaMonitorTransform transform; unsigned int all_transforms; /* Only used to build the logical configuration @@ -185,7 +195,7 @@ struct _MetaCRTCInfo { MetaMonitorMode *mode; int x; int y; - enum wl_output_transform transform; + MetaMonitorTransform transform; GPtrArray *outputs; }; @@ -339,7 +349,7 @@ gboolean meta_monitor_manager_has_hotplug_mode_update (MetaMonitorMana /* 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 (enum wl_output_transform transform) +meta_monitor_transform_is_rotated (MetaMonitorTransform transform) { return (transform % 2); } diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c index 10604e5c6..ad37df6a0 100644 --- a/src/backends/native/meta-monitor-manager-kms.c +++ b/src/backends/native/meta-monitor-manager-kms.c @@ -40,8 +40,6 @@ #include #include "edid.h" -#define ALL_WL_TRANSFORMS ((1 << (WL_OUTPUT_TRANSFORM_FLIPPED_270 + 1)) - 1) - typedef struct { drmModeConnector *connector; @@ -363,9 +361,9 @@ meta_monitor_manager_kms_read_current (MetaMonitorManager *manager) meta_crtc->rect.width = crtc->width; meta_crtc->rect.height = crtc->height; meta_crtc->is_dirty = FALSE; - meta_crtc->transform = WL_OUTPUT_TRANSFORM_NORMAL; + meta_crtc->transform = META_MONITOR_TRANSFORM_NORMAL; /* FIXME: implement! */ - meta_crtc->all_transforms = 1 << WL_OUTPUT_TRANSFORM_NORMAL; + meta_crtc->all_transforms = 1 << META_MONITOR_TRANSFORM_NORMAL; if (crtc->mode_valid) { diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c index e85e26242..eadf3bd8b 100644 --- a/src/backends/x11/meta-monitor-manager-xrandr.c +++ b/src/backends/x11/meta-monitor-manager-xrandr.c @@ -42,7 +42,7 @@ #include "edid.h" #include "meta-monitor-config.h" -#define ALL_WL_TRANSFORMS ((1 << (WL_OUTPUT_TRANSFORM_FLIPPED_270 + 1)) - 1) +#define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1) /* Look for DPI_FALLBACK in: * http://git.gnome.org/browse/gnome-settings-daemon/tree/plugins/xsettings/gsd-xsettings-manager.c @@ -67,31 +67,31 @@ struct _MetaMonitorManagerXrandrClass G_DEFINE_TYPE (MetaMonitorManagerXrandr, meta_monitor_manager_xrandr, META_TYPE_MONITOR_MANAGER); -static enum wl_output_transform -wl_transform_from_xrandr (Rotation rotation) +static MetaMonitorTransform +meta_monitor_transform_from_xrandr (Rotation rotation) { - static const enum wl_output_transform y_reflected_map[4] = { - WL_OUTPUT_TRANSFORM_FLIPPED_180, - WL_OUTPUT_TRANSFORM_FLIPPED_90, - WL_OUTPUT_TRANSFORM_FLIPPED, - WL_OUTPUT_TRANSFORM_FLIPPED_270 + static const MetaMonitorTransform y_reflected_map[4] = { + META_MONITOR_TRANSFORM_FLIPPED_180, + META_MONITOR_TRANSFORM_FLIPPED_90, + META_MONITOR_TRANSFORM_FLIPPED, + META_MONITOR_TRANSFORM_FLIPPED_270 }; - enum wl_output_transform ret; + MetaMonitorTransform ret; switch (rotation & 0x7F) { default: case RR_Rotate_0: - ret = WL_OUTPUT_TRANSFORM_NORMAL; + ret = META_MONITOR_TRANSFORM_NORMAL; break; case RR_Rotate_90: - ret = WL_OUTPUT_TRANSFORM_90; + ret = META_MONITOR_TRANSFORM_90; break; case RR_Rotate_180: - ret = WL_OUTPUT_TRANSFORM_180; + ret = META_MONITOR_TRANSFORM_180; break; case RR_Rotate_270: - ret = WL_OUTPUT_TRANSFORM_270; + ret = META_MONITOR_TRANSFORM_270; break; } @@ -105,35 +105,35 @@ wl_transform_from_xrandr (Rotation rotation) #define ALL_ROTATIONS (RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270) -static unsigned int -wl_transform_from_xrandr_all (Rotation rotation) +static MetaMonitorTransform +meta_monitor_transform_from_xrandr_all (Rotation rotation) { unsigned ret; /* Handle the common cases first (none or all) */ if (rotation == 0 || rotation == RR_Rotate_0) - return (1 << WL_OUTPUT_TRANSFORM_NORMAL); + return (1 << META_MONITOR_TRANSFORM_NORMAL); /* All rotations and one reflection -> all of them by composition */ if ((rotation & ALL_ROTATIONS) && ((rotation & RR_Reflect_X) || (rotation & RR_Reflect_Y))) - return ALL_WL_TRANSFORMS; + return ALL_TRANSFORMS; - ret = 1 << WL_OUTPUT_TRANSFORM_NORMAL; + ret = 1 << META_MONITOR_TRANSFORM_NORMAL; if (rotation & RR_Rotate_90) - ret |= 1 << WL_OUTPUT_TRANSFORM_90; + ret |= 1 << META_MONITOR_TRANSFORM_90; if (rotation & RR_Rotate_180) - ret |= 1 << WL_OUTPUT_TRANSFORM_180; + ret |= 1 << META_MONITOR_TRANSFORM_180; if (rotation & RR_Rotate_270) - ret |= 1 << WL_OUTPUT_TRANSFORM_270; + ret |= 1 << META_MONITOR_TRANSFORM_270; if (rotation & (RR_Rotate_0 | RR_Reflect_X)) - ret |= 1 << WL_OUTPUT_TRANSFORM_FLIPPED; + ret |= 1 << META_MONITOR_TRANSFORM_FLIPPED; if (rotation & (RR_Rotate_90 | RR_Reflect_X)) - ret |= 1 << WL_OUTPUT_TRANSFORM_FLIPPED_90; + ret |= 1 << META_MONITOR_TRANSFORM_FLIPPED_90; if (rotation & (RR_Rotate_180 | RR_Reflect_X)) - ret |= 1 << WL_OUTPUT_TRANSFORM_FLIPPED_180; + ret |= 1 << META_MONITOR_TRANSFORM_FLIPPED_180; if (rotation & (RR_Rotate_270 | RR_Reflect_X)) - ret |= 1 << WL_OUTPUT_TRANSFORM_FLIPPED_270; + ret |= 1 << META_MONITOR_TRANSFORM_FLIPPED_270; return ret; } @@ -434,8 +434,8 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager) meta_crtc->rect.width = crtc->width; meta_crtc->rect.height = crtc->height; meta_crtc->is_dirty = FALSE; - meta_crtc->transform = wl_transform_from_xrandr (crtc->rotation); - meta_crtc->all_transforms = wl_transform_from_xrandr_all (crtc->rotations); + meta_crtc->transform = meta_monitor_transform_from_xrandr (crtc->rotation); + meta_crtc->all_transforms = meta_monitor_transform_from_xrandr_all (crtc->rotations); for (j = 0; j < (unsigned)resources->nmode; j++) { @@ -637,25 +637,25 @@ meta_monitor_manager_xrandr_set_power_save_mode (MetaMonitorManager *manager, } static Rotation -wl_transform_to_xrandr (enum wl_output_transform transform) +meta_monitor_transform_to_xrandr (MetaMonitorTransform transform) { switch (transform) { - case WL_OUTPUT_TRANSFORM_NORMAL: + case META_MONITOR_TRANSFORM_NORMAL: return RR_Rotate_0; - case WL_OUTPUT_TRANSFORM_90: + case META_MONITOR_TRANSFORM_90: return RR_Rotate_90; - case WL_OUTPUT_TRANSFORM_180: + case META_MONITOR_TRANSFORM_180: return RR_Rotate_180; - case WL_OUTPUT_TRANSFORM_270: + case META_MONITOR_TRANSFORM_270: return RR_Rotate_270; - case WL_OUTPUT_TRANSFORM_FLIPPED: + case META_MONITOR_TRANSFORM_FLIPPED: return RR_Reflect_X | RR_Rotate_0; - case WL_OUTPUT_TRANSFORM_FLIPPED_90: + case META_MONITOR_TRANSFORM_FLIPPED_90: return RR_Reflect_X | RR_Rotate_90; - case WL_OUTPUT_TRANSFORM_FLIPPED_180: + case META_MONITOR_TRANSFORM_FLIPPED_180: return RR_Reflect_X | RR_Rotate_180; - case WL_OUTPUT_TRANSFORM_FLIPPED_270: + case META_MONITOR_TRANSFORM_FLIPPED_270: return RR_Reflect_X | RR_Rotate_270; } @@ -847,7 +847,7 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager, manager_xrandr->time, crtc_info->x, crtc_info->y, (XID)mode->mode_id, - wl_transform_to_xrandr (crtc_info->transform), + meta_monitor_transform_to_xrandr (crtc_info->transform), outputs, n_outputs); if (ok != Success) diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c index e17e9df68..dd2c76c07 100644 --- a/src/wayland/meta-wayland-outputs.c +++ b/src/wayland/meta-wayland-outputs.c @@ -168,12 +168,20 @@ wayland_output_destroy_notify (gpointer data) g_slice_free (MetaWaylandOutput, wayland_output); } +static inline enum wl_output_transform +wl_output_transform_from_meta_monitor_transform (MetaMonitorTransform transform) +{ + /* The enums are the same. */ + return (enum wl_output_transform) transform; +} + static void wayland_output_update_for_output (MetaWaylandOutput *wayland_output, MetaOutput *output) { GList *iter; guint mode_flags; + enum wl_output_transform wl_transform = wl_output_transform_from_meta_monitor_transform (output->crtc->transform); g_assert (output->crtc->current_mode != NULL); @@ -187,7 +195,7 @@ wayland_output_update_for_output (MetaWaylandOutput *wayland_output, if (wayland_output->x != output->crtc->rect.x || wayland_output->y != output->crtc->rect.y || - wayland_output->transform != output->crtc->transform) + wayland_output->transform != wl_transform) { wl_resource_post_event (resource, WL_OUTPUT_GEOMETRY, @@ -198,7 +206,7 @@ wayland_output_update_for_output (MetaWaylandOutput *wayland_output, output->subpixel_order, output->vendor, output->product, - output->crtc->transform); + wl_transform); } wl_resource_post_event (resource, @@ -214,7 +222,7 @@ wayland_output_update_for_output (MetaWaylandOutput *wayland_output, wayland_output->output = output; wayland_output->x = output->crtc->rect.x; wayland_output->y = output->crtc->rect.y; - wayland_output->transform = output->crtc->transform; + wayland_output->transform = wl_transform; } static GHashTable *