diff options
Diffstat (limited to 'src/backends')
65 files changed, 2972 insertions, 2381 deletions
diff --git a/src/backends/edid-parse.c b/src/backends/edid-parse.c index a7b9fd225..9072abf48 100644 --- a/src/backends/edid-parse.c +++ b/src/backends/edid-parse.c @@ -59,11 +59,11 @@ decode_vendor_and_product_identification (const uchar *edid, MonitorInfo *info) int is_model_year; /* Manufacturer Code */ - info->manufacturer_code[0] = get_bits (edid[0x08], 2, 6); - info->manufacturer_code[1] = get_bits (edid[0x08], 0, 1) << 3; + info->manufacturer_code[0] = get_bits (edid[0x08], 2, 6); + info->manufacturer_code[1] = get_bits (edid[0x08], 0, 1) << 3; info->manufacturer_code[1] |= get_bits (edid[0x09], 5, 7); - info->manufacturer_code[2] = get_bits (edid[0x09], 0, 4); - info->manufacturer_code[3] = '\0'; + info->manufacturer_code[2] = get_bits (edid[0x09], 0, 4); + info->manufacturer_code[3] = '\0'; info->manufacturer_code[0] += 'A' - 1; info->manufacturer_code[1] += 'A' - 1; @@ -128,14 +128,14 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info) int bits; static const int bit_depth[8] = - { - -1, 6, 8, 10, 12, 14, 16, -1 - }; + { + -1, 6, 8, 10, 12, 14, 16, -1 + }; static const Interface interfaces[6] = - { - UNDEFINED, DVI, HDMI_A, HDMI_B, MDDI, DISPLAY_PORT - }; + { + UNDEFINED, DVI, HDMI_A, HDMI_B, MDDI, DISPLAY_PORT + }; bits = get_bits (edid[0x14], 4, 6); info->connector.digital.bits_per_primary = bit_depth[bits]; @@ -152,12 +152,12 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info) int bits = get_bits (edid[0x14], 5, 6); static const double levels[][3] = - { - { 0.7, 0.3, 1.0 }, - { 0.714, 0.286, 1.0 }, - { 1.0, 0.4, 1.4 }, - { 0.7, 0.0, 0.7 }, - }; + { + { 0.7, 0.3, 1.0 }, + { 0.714, 0.286, 1.0 }, + { 1.0, 0.4, 1.4 }, + { 0.7, 0.0, 0.7 }, + }; info->connector.analog.video_signal_level = levels[bits][0]; info->connector.analog.sync_signal_level = levels[bits][1]; @@ -190,7 +190,7 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info) info->width_mm = -1; info->height_mm = -1; info->aspect_ratio = 100.0 / (edid[0x16] + 99); - info->aspect_ratio = 1/info->aspect_ratio; /* portrait */ + info->aspect_ratio = 1 / info->aspect_ratio; /* portrait */ } else { @@ -221,9 +221,9 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info) { int bits = get_bits (edid[0x18], 3, 4); ColorType color_type[4] = - { - MONOCHROME, RGB, OTHER_COLOR, UNDEFINED_COLOR - }; + { + MONOCHROME, RGB, OTHER_COLOR, UNDEFINED_COLOR + }; info->connector.analog.color_type = color_type[bits]; } @@ -271,38 +271,38 @@ static int decode_established_timings (const uchar *edid, MonitorInfo *info) { static const Timing established[][8] = + { { - { - { 800, 600, 60 }, - { 800, 600, 56 }, - { 640, 480, 75 }, - { 640, 480, 72 }, - { 640, 480, 67 }, - { 640, 480, 60 }, - { 720, 400, 88 }, - { 720, 400, 70 } - }, - { - { 1280, 1024, 75 }, - { 1024, 768, 75 }, - { 1024, 768, 70 }, - { 1024, 768, 60 }, - { 1024, 768, 87 }, - { 832, 624, 75 }, - { 800, 600, 75 }, - { 800, 600, 72 } - }, - { - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 1152, 870, 75 } - }, - }; + { 800, 600, 60 }, + { 800, 600, 56 }, + { 640, 480, 75 }, + { 640, 480, 72 }, + { 640, 480, 67 }, + { 640, 480, 60 }, + { 720, 400, 88 }, + { 720, 400, 70 } + }, + { + { 1280, 1024, 75 }, + { 1024, 768, 75 }, + { 1024, 768, 70 }, + { 1024, 768, 60 }, + { 1024, 768, 87 }, + { 832, 624, 75 }, + { 800, 600, 75 }, + { 800, 600, 72 } + }, + { + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 1152, 870, 75 } + }, + }; int i, j, idx; @@ -310,12 +310,12 @@ decode_established_timings (const uchar *edid, MonitorInfo *info) for (i = 0; i < 3; ++i) { for (j = 0; j < 8; ++j) - { + { int byte = edid[0x23 + i]; if (get_bit (byte, j) && established[i][j].frequency != 0) info->established[idx++] = established[i][j]; - } + } } return TRUE; } @@ -331,22 +331,26 @@ decode_standard_timings (const uchar *edid, MonitorInfo *info) int second = edid[0x27 + 2 * i]; if (first != 0x01 && second != 0x01) - { + { int w = 8 * (first + 31); int h = 0; switch (get_bits (second, 6, 7)) { - case 0x00: h = (w / 16) * 10; break; - case 0x01: h = (w / 4) * 3; break; - case 0x02: h = (w / 5) * 4; break; - case 0x03: h = (w / 16) * 9; break; - } + case 0x00: h = (w / 16) * 10; + break; + case 0x01: h = (w / 4) * 3; + break; + case 0x02: h = (w / 5) * 4; + break; + case 0x03: h = (w / 16) * 9; + break; + } info->standard[i].width = w; info->standard[i].height = h; info->standard[i].frequency = get_bits (second, 0, 5) + 60; - } + } } return TRUE; @@ -359,25 +363,25 @@ decode_lf_string (const uchar *s, int n_chars, char *result) for (i = 0; i < n_chars; ++i) { if (s[i] == 0x0a) - { + { *result++ = '\0'; break; - } + } else if (s[i] == 0x00) - { + { /* Convert embedded 0's to spaces */ *result++ = ' '; - } + } else - { + { *result++ = s[i]; - } + } } } static void decode_display_descriptor (const uchar *desc, - MonitorInfo *info) + MonitorInfo *info) { switch (desc[0x03]) { @@ -414,16 +418,16 @@ decode_display_descriptor (const uchar *desc, } static void -decode_detailed_timing (const uchar *timing, - DetailedTiming *detailed) +decode_detailed_timing (const uchar *timing, + DetailedTiming *detailed) { int bits; StereoType stereo[] = - { - NO_STEREO, NO_STEREO, FIELD_RIGHT, FIELD_LEFT, - TWO_WAY_RIGHT_ON_EVEN, TWO_WAY_LEFT_ON_EVEN, - FOUR_WAY_INTERLEAVED, SIDE_BY_SIDE - }; + { + NO_STEREO, NO_STEREO, FIELD_RIGHT, FIELD_LEFT, + TWO_WAY_RIGHT_ON_EVEN, TWO_WAY_LEFT_ON_EVEN, + FOUR_WAY_INTERLEAVED, SIDE_BY_SIDE + }; detailed->pixel_clock = (timing[0x00] | timing[0x01] << 8) * 10000; detailed->h_addr = timing[0x02] | ((timing[0x04] & 0xf0) << 4); @@ -436,7 +440,7 @@ decode_detailed_timing (const uchar *timing, get_bits (timing[0x0a], 4, 7) | get_bits (timing[0x0b], 2, 3) << 4; detailed->v_sync = get_bits (timing[0x0a], 0, 3) | get_bits (timing[0x0b], 0, 1) << 4; - detailed->width_mm = timing[0x0c] | get_bits (timing[0x0e], 4, 7) << 8; + detailed->width_mm = timing[0x0c] | get_bits (timing[0x0e], 4, 7) << 8; detailed->height_mm = timing[0x0d] | get_bits (timing[0x0e], 0, 3) << 8; detailed->right_border = timing[0x0f]; detailed->top_border = timing[0x10]; @@ -456,15 +460,15 @@ decode_detailed_timing (const uchar *timing, detailed->connector.digital.composite = !get_bit (bits, 3); if (detailed->connector.digital.composite) - { + { detailed->connector.digital.serrations = get_bit (bits, 2); detailed->connector.digital.negative_vsync = FALSE; - } + } else - { + { detailed->connector.digital.serrations = FALSE; detailed->connector.digital.negative_vsync = !get_bit (bits, 2); - } + } detailed->connector.digital.negative_hsync = !get_bit (bits, 0); } @@ -489,13 +493,14 @@ decode_descriptors (const uchar *edid, MonitorInfo *info) int index = 0x36 + i * 18; if (edid[index + 0] == 0x00 && edid[index + 1] == 0x00) - { + { decode_display_descriptor (edid + index, info); - } + } else - { - decode_detailed_timing (edid + index, &(info->detailed_timings[timing_idx++])); - } + { + decode_detailed_timing (edid + index, + &(info->detailed_timings[timing_idx++])); + } } info->n_detailed_timings = timing_idx; @@ -505,7 +510,7 @@ decode_descriptors (const uchar *edid, MonitorInfo *info) static void decode_check_sum (const uchar *edid, - MonitorInfo *info) + MonitorInfo *info) { int i; uchar check = 0; diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c index 709d4194c..345bc32a6 100644 --- a/src/backends/meta-backend.c +++ b/src/backends/meta-backend.c @@ -153,7 +153,8 @@ meta_backend_finalize (GObject *object) #endif if (priv->sleep_signal_id) - g_dbus_connection_signal_unsubscribe (priv->system_bus, priv->sleep_signal_id); + g_dbus_connection_signal_unsubscribe (priv->system_bus, + priv->sleep_signal_id); if (priv->upower_watch_id) g_bus_unwatch_name (priv->upower_watch_id); g_cancellable_cancel (priv->cancellable); @@ -206,7 +207,8 @@ meta_backend_monitors_changed (MetaBackend *backend) MetaMonitorManager *monitor_manager = meta_backend_get_monitor_manager (backend); ClutterDeviceManager *manager = clutter_device_manager_get_default (); - ClutterInputDevice *device = clutter_device_manager_get_core_device (manager, CLUTTER_POINTER_DEVICE); + ClutterInputDevice *device = clutter_device_manager_get_core_device (manager, + CLUTTER_POINTER_DEVICE); ClutterPoint point; meta_backend_sync_screen_size (backend); @@ -277,7 +279,8 @@ create_device_monitor (MetaBackend *backend, g_assert (g_hash_table_lookup (priv->device_monitors, &device_id) == NULL); idle_monitor = meta_backend_create_idle_monitor (backend, device_id); - g_hash_table_insert (priv->device_monitors, &idle_monitor->device_id, idle_monitor); + g_hash_table_insert (priv->device_monitors, &idle_monitor->device_id, + idle_monitor); } static void @@ -313,8 +316,10 @@ on_device_added (ClutterDeviceManager *device_manager, static inline gboolean device_is_slave_touchscreen (ClutterInputDevice *device) { - return (clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_MASTER && - clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE); + return (clutter_input_device_get_device_mode (device) != + CLUTTER_INPUT_MODE_MASTER && + clutter_input_device_get_device_type (device) == + CLUTTER_TOUCHSCREEN_DEVICE); } static inline gboolean @@ -328,10 +333,13 @@ check_has_pointing_device (ClutterDeviceManager *manager) { ClutterInputDevice *device = devices->data; - if (clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_MASTER) + if (clutter_input_device_get_device_mode (device) == + CLUTTER_INPUT_MODE_MASTER) continue; - if (clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE || - clutter_input_device_get_device_type (device) == CLUTTER_KEYBOARD_DEVICE) + if (clutter_input_device_get_device_type (device) == + CLUTTER_TOUCHSCREEN_DEVICE || + clutter_input_device_get_device_type (device) == + CLUTTER_KEYBOARD_DEVICE) continue; return TRUE; @@ -351,8 +359,10 @@ check_has_slave_touchscreen (ClutterDeviceManager *manager) { ClutterInputDevice *device = devices->data; - if (clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_MASTER && - clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE) + if (clutter_input_device_get_device_mode (device) != + CLUTTER_INPUT_MODE_MASTER && + clutter_input_device_get_device_type (device) == + CLUTTER_TOUCHSCREEN_DEVICE) return TRUE; } @@ -458,7 +468,8 @@ meta_backend_real_post_init (MetaBackend *backend) meta_backend_sync_screen_size (backend); - priv->cursor_renderer = META_BACKEND_GET_CLASS (backend)->create_cursor_renderer (backend); + priv->cursor_renderer = + META_BACKEND_GET_CLASS (backend)->create_cursor_renderer (backend); priv->device_monitors = g_hash_table_new_full (g_int_hash, g_int_equal, @@ -478,7 +489,8 @@ meta_backend_real_post_init (MetaBackend *backend) #ifdef HAVE_REMOTE_DESKTOP priv->remote_access_controller = g_object_new (META_TYPE_REMOTE_ACCESS_CONTROLLER, NULL); - priv->dbus_session_watcher = g_object_new (META_TYPE_DBUS_SESSION_WATCHER, NULL); + priv->dbus_session_watcher = g_object_new (META_TYPE_DBUS_SESSION_WATCHER, + NULL); priv->screen_cast = meta_screen_cast_new (priv->dbus_session_watcher); priv->remote_desktop = meta_remote_desktop_new (priv->dbus_session_watcher); #endif /* HAVE_REMOTE_DESKTOP */ @@ -521,12 +533,12 @@ meta_backend_real_select_stage_events (MetaBackend *backend) } static gboolean -meta_backend_real_get_relative_motion_deltas (MetaBackend *backend, - const ClutterEvent *event, - double *dx, - double *dy, - double *dx_unaccel, - double *dy_unaccel) +meta_backend_real_get_relative_motion_deltas (MetaBackend *backend, + const ClutterEvent *event, + double *dx, + double *dy, + double *dx_unaccel, + double *dy_unaccel) { return FALSE; } @@ -655,7 +667,7 @@ meta_backend_constructed (GObject *object) MetaBackend *backend = META_BACKEND (object); MetaBackendPrivate *priv = meta_backend_get_instance_private (backend); MetaBackendClass *backend_class = - META_BACKEND_GET_CLASS (backend); + META_BACKEND_GET_CLASS (backend); if (backend_class->is_lid_closed != meta_backend_real_is_lid_closed) return; @@ -683,7 +695,8 @@ meta_backend_class_init (MetaBackendClass *klass) klass->grab_device = meta_backend_real_grab_device; klass->ungrab_device = meta_backend_real_ungrab_device; klass->select_stage_events = meta_backend_real_select_stage_events; - klass->get_relative_motion_deltas = meta_backend_real_get_relative_motion_deltas; + klass->get_relative_motion_deltas = + meta_backend_real_get_relative_motion_deltas; klass->is_lid_closed = meta_backend_real_is_lid_closed; signals[KEYMAP_CHANGED] = @@ -782,9 +795,9 @@ system_bus_gotten_cb (GObject *object, } static gboolean -meta_backend_initable_init (GInitable *initable, - GCancellable *cancellable, - GError **error) +meta_backend_initable_init (GInitable *initable, + GCancellable *cancellable, + GError **error) { MetaBackend *backend = META_BACKEND (initable); MetaBackendPrivate *priv = meta_backend_get_instance_private (backend); @@ -795,7 +808,8 @@ meta_backend_initable_init (GInitable *initable, priv->egl = g_object_new (META_TYPE_EGL, NULL); #endif - priv->orientation_manager = g_object_new (META_TYPE_ORIENTATION_MANAGER, NULL); + priv->orientation_manager = + g_object_new (META_TYPE_ORIENTATION_MANAGER, NULL); priv->monitor_manager = meta_backend_create_monitor_manager (backend, error); if (!priv->monitor_manager) @@ -967,7 +981,8 @@ meta_backend_grab_device (MetaBackend *backend, int device_id, uint32_t timestamp) { - return META_BACKEND_GET_CLASS (backend)->grab_device (backend, device_id, timestamp); + return META_BACKEND_GET_CLASS (backend)->grab_device (backend, device_id, + timestamp); } /** @@ -978,7 +993,8 @@ meta_backend_ungrab_device (MetaBackend *backend, int device_id, uint32_t timestamp) { - return META_BACKEND_GET_CLASS (backend)->ungrab_device (backend, device_id, timestamp); + return META_BACKEND_GET_CLASS (backend)->ungrab_device (backend, device_id, + timestamp); } /** @@ -1004,7 +1020,8 @@ meta_backend_set_keymap (MetaBackend *backend, const char *variants, const char *options) { - META_BACKEND_GET_CLASS (backend)->set_keymap (backend, layouts, variants, options); + META_BACKEND_GET_CLASS (backend)->set_keymap (backend, layouts, variants, + options); } /** @@ -1025,7 +1042,7 @@ meta_backend_get_keymap_layout_group (MetaBackend *backend) void meta_backend_lock_layout_group (MetaBackend *backend, - guint idx) + guint idx) { META_BACKEND_GET_CLASS (backend)->lock_layout_group (backend, idx); } @@ -1101,7 +1118,8 @@ meta_backend_update_last_device (MetaBackend *backend, device = clutter_device_manager_get_device (manager, device_id); if (!device || - clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_MASTER) + clutter_input_device_get_device_mode (device) == + CLUTTER_INPUT_MODE_MASTER) return; priv->current_device_id = device_id; @@ -1116,12 +1134,12 @@ meta_backend_update_last_device (MetaBackend *backend, } gboolean -meta_backend_get_relative_motion_deltas (MetaBackend *backend, - const ClutterEvent *event, - double *dx, - double *dy, - double *dx_unaccel, - double *dy_unaccel) +meta_backend_get_relative_motion_deltas (MetaBackend *backend, + const ClutterEvent *event, + double *dx, + double *dy, + double *dx_unaccel, + double *dy_unaccel) { MetaBackendClass *klass = META_BACKEND_GET_CLASS (backend); return klass->get_relative_motion_deltas (backend, @@ -1163,8 +1181,8 @@ meta_backend_set_client_pointer_constraint (MetaBackend *backend, */ static gboolean -event_prepare (GSource *source, - gint *timeout_) +event_prepare (GSource *source, + gint *timeout_) { *timeout_ = -1; @@ -1193,7 +1211,8 @@ event_dispatch (GSource *source, return TRUE; } -static GSourceFuncs event_funcs = { +static GSourceFuncs event_funcs = +{ event_prepare, event_check, event_dispatch diff --git a/src/backends/meta-barrier.c b/src/backends/meta-barrier.c index 3b108c5e7..f7b92e482 100644 --- a/src/backends/meta-barrier.c +++ b/src/backends/meta-barrier.c @@ -1,4 +1,5 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; c-basic-offset: 2; + * -*- */ /** * SECTION:barrier @@ -26,7 +27,8 @@ G_DEFINE_TYPE_WITH_PRIVATE (MetaBarrier, meta_barrier, G_TYPE_OBJECT) G_DEFINE_TYPE (MetaBarrierImpl, meta_barrier_impl, G_TYPE_OBJECT) -enum { +enum +{ PROP_0, PROP_DISPLAY, @@ -42,7 +44,8 @@ enum { static GParamSpec *obj_props[PROP_LAST]; -enum { +enum +{ HIT, LEFT, @@ -209,35 +212,40 @@ meta_barrier_class_init (MetaBarrierClass *klass) "Display", "The display to construct the pointer barrier on", META_TYPE_DISPLAY, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); obj_props[PROP_X1] = g_param_spec_int ("x1", "X1", "The first X coordinate of the barrier", 0, G_MAXSHORT, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); obj_props[PROP_Y1] = g_param_spec_int ("y1", "Y1", "The first Y coordinate of the barrier", 0, G_MAXSHORT, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); obj_props[PROP_X2] = g_param_spec_int ("x2", "X2", "The second X coordinate of the barrier", 0, G_MAXSHORT, G_MAXSHORT, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); obj_props[PROP_Y2] = g_param_spec_int ("y2", "Y2", "The second Y coordinate of the barrier", 0, G_MAXSHORT, G_MAXSHORT, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); obj_props[PROP_DIRECTIONS] = g_param_spec_flags ("directions", @@ -245,7 +253,8 @@ meta_barrier_class_init (MetaBarrierClass *klass) "A set of directions to let the pointer through", META_TYPE_BARRIER_DIRECTION, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, PROP_LAST, obj_props); @@ -300,7 +309,8 @@ meta_barrier_destroy (MetaBarrier *barrier) static void meta_barrier_init (MetaBarrier *barrier) { - barrier->priv = G_TYPE_INSTANCE_GET_PRIVATE (barrier, META_TYPE_BARRIER, MetaBarrierPrivate); + barrier->priv = G_TYPE_INSTANCE_GET_PRIVATE (barrier, META_TYPE_BARRIER, + MetaBarrierPrivate); } void @@ -336,7 +346,7 @@ meta_barrier_event_ref (MetaBarrierEvent *event) g_return_val_if_fail (event != NULL, NULL); g_return_val_if_fail (event->ref_count > 0, NULL); - g_atomic_int_inc ((volatile int *)&event->ref_count); + g_atomic_int_inc ((volatile int *) &event->ref_count); return event; } @@ -346,7 +356,7 @@ meta_barrier_event_unref (MetaBarrierEvent *event) g_return_if_fail (event != NULL); g_return_if_fail (event->ref_count > 0); - if (g_atomic_int_dec_and_test ((volatile int *)&event->ref_count)) + if (g_atomic_int_dec_and_test ((volatile int *) &event->ref_count)) g_slice_free (MetaBarrierEvent, event); } diff --git a/src/backends/meta-crtc.c b/src/backends/meta-crtc.c index 7ca31ba39..14a0033b8 100644 --- a/src/backends/meta-crtc.c +++ b/src/backends/meta-crtc.c @@ -26,7 +26,7 @@ G_DEFINE_TYPE (MetaCrtc, meta_crtc, G_TYPE_OBJECT) G_DEFINE_TYPE (MetaCrtcMode, meta_crtc_mode, G_TYPE_OBJECT) MetaGpu * -meta_crtc_get_gpu (MetaCrtc *crtc) +meta_crtc_get_gpu (MetaCrtc * crtc) { return crtc->gpu; } diff --git a/src/backends/meta-cursor-renderer.c b/src/backends/meta-cursor-renderer.c index 1f76206f8..6864fd556 100644 --- a/src/backends/meta-cursor-renderer.c +++ b/src/backends/meta-cursor-renderer.c @@ -46,13 +46,15 @@ struct _MetaCursorRendererPrivate }; typedef struct _MetaCursorRendererPrivate MetaCursorRendererPrivate; -enum { +enum +{ CURSOR_PAINTED, LAST_SIGNAL }; static guint signals[LAST_SIGNAL]; -G_DEFINE_TYPE_WITH_PRIVATE (MetaCursorRenderer, meta_cursor_renderer, G_TYPE_OBJECT); +G_DEFINE_TYPE_WITH_PRIVATE (MetaCursorRenderer, meta_cursor_renderer, + G_TYPE_OBJECT); void meta_cursor_renderer_emit_painted (MetaCursorRenderer *renderer, @@ -65,7 +67,8 @@ static void queue_redraw (MetaCursorRenderer *renderer, MetaCursorSprite *cursor_sprite) { - MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer); + MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private ( + renderer); MetaBackend *backend = meta_get_backend (); ClutterActor *stage = meta_backend_get_stage (backend); CoglTexture *texture; @@ -117,7 +120,8 @@ static void meta_cursor_renderer_finalize (GObject *object) { MetaCursorRenderer *renderer = META_CURSOR_RENDERER (object); - MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer); + MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private ( + renderer); MetaBackend *backend = meta_get_backend (); ClutterActor *stage = meta_backend_get_stage (backend); @@ -180,14 +184,16 @@ meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer, height = cogl_texture_get_height (texture); return (ClutterRect) { - .origin = { - .x = priv->current_x - (hot_x * texture_scale), - .y = priv->current_y - (hot_y * texture_scale) - }, - .size = { - .width = width * texture_scale, - .height = height * texture_scale - } + .origin = + { + .x = priv->current_x - (hot_x * texture_scale), + .y = priv->current_y - (hot_y * texture_scale) + }, + .size = + { + .width = width * texture_scale, + .height = height * texture_scale + } }; } @@ -195,7 +201,8 @@ static void meta_cursor_renderer_update_cursor (MetaCursorRenderer *renderer, MetaCursorSprite *cursor_sprite) { - MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer); + MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private ( + renderer); gboolean handled_by_backend; gboolean should_redraw = FALSE; @@ -230,7 +237,8 @@ void meta_cursor_renderer_set_cursor (MetaCursorRenderer *renderer, MetaCursorSprite *cursor_sprite) { - MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer); + MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private ( + renderer); if (priv->displayed_cursor == cursor_sprite) return; @@ -253,7 +261,8 @@ meta_cursor_renderer_set_position (MetaCursorRenderer *renderer, float x, float y) { - MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer); + MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private ( + renderer); g_assert (meta_is_wayland_compositor ()); @@ -270,15 +279,16 @@ meta_cursor_renderer_get_position (MetaCursorRenderer *renderer) meta_cursor_renderer_get_instance_private (renderer); return (ClutterPoint) { - .x = priv->current_x, - .y = priv->current_y + .x = priv->current_x, + .y = priv->current_y }; } MetaCursorSprite * meta_cursor_renderer_get_cursor (MetaCursorRenderer *renderer) { - MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer); + MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private ( + renderer); return priv->displayed_cursor; } diff --git a/src/backends/meta-cursor-sprite-xcursor.c b/src/backends/meta-cursor-sprite-xcursor.c index 49d10b94c..a5f81d79d 100644 --- a/src/backends/meta-cursor-sprite-xcursor.c +++ b/src/backends/meta-cursor-sprite-xcursor.c @@ -99,8 +99,8 @@ meta_cursor_sprite_xcursor_get_cursor (MetaCursorSpriteXcursor *sprite_xcursor) } Cursor -meta_create_x_cursor (Display *xdisplay, - MetaCursor cursor) +meta_create_x_cursor (Display *xdisplay, + MetaCursor cursor) { return XcursorLibraryLoadCursor (xdisplay, translate_meta_cursor (cursor)); } @@ -160,8 +160,9 @@ load_from_current_xcursor_image (MetaCursorSpriteXcursor *sprite_xcursor) } void -meta_cursor_sprite_xcursor_set_theme_scale (MetaCursorSpriteXcursor *sprite_xcursor, - int theme_scale) +meta_cursor_sprite_xcursor_set_theme_scale ( + MetaCursorSpriteXcursor *sprite_xcursor, + int theme_scale) { if (sprite_xcursor->theme_scale != theme_scale) sprite_xcursor->theme_dirty = TRUE; @@ -178,7 +179,8 @@ meta_cursor_sprite_xcursor_is_animated (MetaCursorSprite *sprite) } XcursorImage * -meta_cursor_sprite_xcursor_get_current_image (MetaCursorSpriteXcursor *sprite_xcursor) +meta_cursor_sprite_xcursor_get_current_image ( + MetaCursorSpriteXcursor *sprite_xcursor) { return sprite_xcursor->xcursor_images->images[sprite_xcursor->current_frame]; } diff --git a/src/backends/meta-cursor-tracker.c b/src/backends/meta-cursor-tracker.c index d33fa300a..d7597b9b3 100644 --- a/src/backends/meta-cursor-tracker.c +++ b/src/backends/meta-cursor-tracker.c @@ -46,7 +46,8 @@ G_DEFINE_TYPE (MetaCursorTracker, meta_cursor_tracker, G_TYPE_OBJECT); -enum { +enum +{ CURSOR_CHANGED, LAST_SIGNAL }; @@ -204,7 +205,7 @@ meta_cursor_tracker_handle_xevent (MetaCursorTracker *tracker, if (xevent->xany.type != x11_display->xfixes_event_base + XFixesCursorNotify) return FALSE; - notify_event = (XFixesCursorNotifyEvent *)xevent; + notify_event = (XFixesCursorNotifyEvent *) xevent; if (notify_event->subtype != XFixesDisplayCursorNotify) return FALSE; @@ -337,9 +338,9 @@ meta_cursor_tracker_update_position (MetaCursorTracker *tracker, } static void -get_pointer_position_gdk (int *x, - int *y, - int *mods) +get_pointer_position_gdk (int *x, + int *y, + int *mods) { GdkSeat *gseat; GdkDevice *gdevice; @@ -352,20 +353,21 @@ get_pointer_position_gdk (int *x, if (mods) gdk_device_get_state (gdevice, gdk_screen_get_root_window (gscreen), - NULL, (GdkModifierType*)mods); + NULL, (GdkModifierType *) mods); } static void -get_pointer_position_clutter (int *x, - int *y, - int *mods) +get_pointer_position_clutter (int *x, + int *y, + int *mods) { ClutterDeviceManager *cmanager; ClutterInputDevice *cdevice; ClutterPoint point; cmanager = clutter_device_manager_get_default (); - cdevice = clutter_device_manager_get_core_device (cmanager, CLUTTER_POINTER_DEVICE); + cdevice = clutter_device_manager_get_core_device (cmanager, + CLUTTER_POINTER_DEVICE); clutter_input_device_get_coords (cdevice, NULL, &point); if (x) @@ -382,15 +384,17 @@ meta_cursor_tracker_get_pointer (MetaCursorTracker *tracker, int *y, ClutterModifierType *mods) { - /* We can't use the clutter interface when not running as a wayland compositor, - because we need to query the server, rather than using the last cached value. - OTOH, on wayland we can't use GDK, because that only sees the events - we forward to xwayland. - */ + /* We can't use the clutter interface when not running as a wayland + * compositor, + * because we need to query the server, rather than using the last cached + * value. + * OTOH, on wayland we can't use GDK, because that only sees the events + * we forward to xwayland. + */ if (meta_is_wayland_compositor ()) - get_pointer_position_clutter (x, y, (int*)mods); + get_pointer_position_clutter (x, y, (int *) mods); else - get_pointer_position_gdk (x, y, (int*)mods); + get_pointer_position_gdk (x, y, (int *) mods); } void diff --git a/src/backends/meta-dbus-session-watcher.c b/src/backends/meta-dbus-session-watcher.c index 22718e6c2..bff96c1a2 100644 --- a/src/backends/meta-dbus-session-watcher.c +++ b/src/backends/meta-dbus-session-watcher.c @@ -92,8 +92,9 @@ meta_dbus_session_client_destroy (MetaDbusSessionClient *client) } static void -meta_dbus_session_watcher_destroy_client (MetaDbusSessionWatcher *session_watcher, - MetaDbusSessionClient *client) +meta_dbus_session_watcher_destroy_client ( + MetaDbusSessionWatcher *session_watcher, + MetaDbusSessionClient *client) { g_hash_table_remove (session_watcher->clients, client->dbus_name); } @@ -169,9 +170,10 @@ meta_dbus_session_watcher_get_client (MetaDbusSessionWatcher *session_watcher, } void -meta_dbus_session_watcher_watch_session (MetaDbusSessionWatcher *session_watcher, - const char *client_dbus_name, - MetaDbusSession *session) +meta_dbus_session_watcher_watch_session ( + MetaDbusSessionWatcher *session_watcher, + const char *client_dbus_name, + MetaDbusSession *session) { MetaDbusSessionClient *client; diff --git a/src/backends/meta-egl.c b/src/backends/meta-egl.c index c60dd2eaa..4fa7f40b3 100644 --- a/src/backends/meta-egl.c +++ b/src/backends/meta-egl.c @@ -62,7 +62,8 @@ struct _MetaEgl PFNEGLSTREAMCONSUMEROUTPUTEXTPROC eglStreamConsumerOutputEXT; - PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC eglStreamConsumerGLTextureExternalKHR; + PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC + eglStreamConsumerGLTextureExternalKHR; PFNEGLSTREAMCONSUMERACQUIREKHRPROC eglStreamConsumerAcquireKHR; PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC eglStreamConsumerAcquireAttribNV; @@ -73,7 +74,7 @@ struct _MetaEgl G_DEFINE_TYPE (MetaEgl, meta_egl, G_TYPE_OBJECT) -G_DEFINE_QUARK (-meta-egl-error-quark, meta_egl_error) +G_DEFINE_QUARK (-meta - egl - error - quark, meta_egl_error) static const char * get_egl_error_str (EGLint error_number) @@ -84,46 +85,58 @@ get_egl_error_str (EGLint error_number) return "The last function succeeded without error."; break; case EGL_NOT_INITIALIZED: - return "EGL is not initialized, or could not be initialized, for the specified EGL display connection."; + return + "EGL is not initialized, or could not be initialized, for the specified EGL display connection."; break; case EGL_BAD_ACCESS: - return "EGL cannot access a requested resource (for example a context is bound in another thread)."; + return + "EGL cannot access a requested resource (for example a context is bound in another thread)."; break; case EGL_BAD_ALLOC: return "EGL failed to allocate resources for the requested operation."; break; case EGL_BAD_ATTRIBUTE: - return "An unrecognized attribute or attribute value was passed in the attribute list."; + return + "An unrecognized attribute or attribute value was passed in the attribute list."; break; case EGL_BAD_CONTEXT: - return "An EGLContext argument does not name a valid EGL rendering context."; + return + "An EGLContext argument does not name a valid EGL rendering context."; break; case EGL_BAD_CONFIG: - return "An EGLConfig argument does not name a valid EGL frame buffer configuration."; + return + "An EGLConfig argument does not name a valid EGL frame buffer configuration."; break; case EGL_BAD_CURRENT_SURFACE: - return "The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid."; + return + "The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid."; break; case EGL_BAD_DISPLAY: - return "An EGLDisplay argument does not name a valid EGL display connection."; + return + "An EGLDisplay argument does not name a valid EGL display connection."; break; case EGL_BAD_SURFACE: - return "An EGLSurface argument does not name a valid surface (window, pixel buffer or pixmap) configured for GL rendering."; + return + "An EGLSurface argument does not name a valid surface (window, pixel buffer or pixmap) configured for GL rendering."; break; case EGL_BAD_MATCH: - return "Arguments are inconsistent (for example, a valid context requires buffers not supplied by a valid surface)."; + return + "Arguments are inconsistent (for example, a valid context requires buffers not supplied by a valid surface)."; break; case EGL_BAD_PARAMETER: return "One or more argument values are invalid."; break; case EGL_BAD_NATIVE_PIXMAP: - return "A NativePixmapType argument does not refer to a valid native pixmap."; + return + "A NativePixmapType argument does not refer to a valid native pixmap."; break; case EGL_BAD_NATIVE_WINDOW: - return "A NativeWindowType argument does not refer to a valid native window."; + return + "A NativeWindowType argument does not refer to a valid native window."; break; case EGL_CONTEXT_LOST: - return "A power management event has occurred. The application must destroy all contexts and reinitialise OpenGL ES state and objects to continue rendering. "; + return + "A power management event has occurred. The application must destroy all contexts and reinitialise OpenGL ES state and objects to continue rendering. "; break; case EGL_BAD_STREAM_KHR: return "An EGLStreamKHR argument does not name a valid EGL stream."; @@ -135,9 +148,11 @@ get_egl_error_str (EGLint error_number) return "An EGLDeviceEXT argument does not name a valid EGL device."; break; case EGL_BAD_OUTPUT_LAYER_EXT: - return "An EGLOutputLayerEXT argument does not name a valid EGL output layer."; + return + "An EGLOutputLayerEXT argument does not name a valid EGL output layer."; case EGL_RESOURCE_BUSY_EXT: - return "The operation could not be completed on the requested resource because it is temporary unavailable."; + return + "The operation could not be completed on the requested resource because it is temporary unavailable."; default: return "Unknown error"; break; @@ -266,12 +281,12 @@ meta_egl_get_proc_address (MetaEgl *egl, } gboolean -meta_egl_get_config_attrib (MetaEgl *egl, - EGLDisplay display, - EGLConfig config, - EGLint attribute, - EGLint *value, - GError **error) +meta_egl_get_config_attrib (MetaEgl *egl, + EGLDisplay display, + EGLConfig config, + EGLint attribute, + EGLint *value, + GError **error) { if (!eglGetConfigAttrib (display, config, @@ -286,11 +301,11 @@ meta_egl_get_config_attrib (MetaEgl *egl, } EGLConfig * -meta_egl_choose_all_configs (MetaEgl *egl, - EGLDisplay display, - const EGLint *attrib_list, - EGLint *out_num_configs, - GError **error) +meta_egl_choose_all_configs (MetaEgl *egl, + EGLDisplay display, + const EGLint *attrib_list, + EGLint *out_num_configs, + GError **error) { EGLint num_configs; EGLConfig *configs; @@ -312,7 +327,8 @@ meta_egl_choose_all_configs (MetaEgl *egl, configs = g_new0 (EGLConfig, num_configs); - if (!eglChooseConfig (display, attrib_list, configs, num_configs, &num_matches)) + if (!eglChooseConfig (display, attrib_list, configs, num_configs, + &num_matches)) { g_free (configs); set_egl_error (error); @@ -332,11 +348,11 @@ meta_egl_choose_all_configs (MetaEgl *egl, } gboolean -meta_egl_choose_first_config (MetaEgl *egl, - EGLDisplay display, - const EGLint *attrib_list, - EGLConfig *chosen_config, - GError **error) +meta_egl_choose_first_config (MetaEgl *egl, + EGLDisplay display, + const EGLint *attrib_list, + EGLConfig *chosen_config, + GError **error) { EGLint num_configs; EGLConfig *configs; @@ -358,7 +374,8 @@ meta_egl_choose_first_config (MetaEgl *egl, configs = g_new0 (EGLConfig, num_configs); - if (!eglChooseConfig (display, attrib_list, configs, num_configs, &num_matches)) + if (!eglChooseConfig (display, attrib_list, configs, num_configs, + &num_matches)) { g_free (configs); set_egl_error (error); @@ -615,7 +632,7 @@ meta_egl_query_wayland_buffer (MetaEgl *egl, GError **error) { if (!is_egl_proc_valid (egl->eglQueryWaylandBufferWL, error)) - return FALSE; + return FALSE; if (!egl->eglQueryWaylandBufferWL (display, buffer, attribute, value)) { @@ -827,10 +844,10 @@ meta_egl_create_stream_attrib (MetaEgl *egl, } EGLSurface -meta_egl_create_stream_producer_surface (MetaEgl *egl, - EGLDisplay display, - EGLConfig config, - EGLStreamKHR stream, +meta_egl_create_stream_producer_surface (MetaEgl *egl, + EGLDisplay display, + EGLConfig config, + EGLStreamKHR stream, const EGLint *attrib_list, GError **error) { @@ -944,7 +961,7 @@ meta_egl_query_dma_buf_formats (MetaEgl *egl, return FALSE; } - return TRUE; + return TRUE; } gboolean @@ -968,7 +985,7 @@ meta_egl_query_dma_buf_modifiers (MetaEgl *egl, return FALSE; } - return TRUE; + return TRUE; } #define GET_EGL_PROC_ADDR(proc) \ diff --git a/src/backends/meta-gles3.c b/src/backends/meta-gles3.c index f467a8f94..98bfd8345 100644 --- a/src/backends/meta-gles3.c +++ b/src/backends/meta-gles3.c @@ -42,7 +42,7 @@ struct _MetaGles3 G_DEFINE_TYPE (MetaGles3, meta_gles3, G_TYPE_OBJECT) MetaGles3Table * -meta_gles3_get_table (MetaGles3 *gles3) +meta_gles3_get_table (MetaGles3 * gles3) { return &gles3->table; } @@ -72,15 +72,15 @@ get_gl_error_str (GLenum gl_error) case GL_INVALID_ENUM: return "An unacceptable value is specified for an enumerated argument."; case GL_INVALID_VALUE: - return "A numeric argument is out of range."; + return "A numeric argument is out of range."; case GL_INVALID_OPERATION: - return "The specified operation is not allowed in the current state."; + return "The specified operation is not allowed in the current state."; case GL_INVALID_FRAMEBUFFER_OPERATION: - return "The framebuffer object is not complete."; + return "The framebuffer object is not complete."; case GL_OUT_OF_MEMORY: - return "There is not enough memory left to execute the command."; + return "There is not enough memory left to execute the command."; default: - return "Unknown error"; + return "Unknown error"; } } diff --git a/src/backends/meta-gpu.c b/src/backends/meta-gpu.c index 3577391e5..164df6c44 100644 --- a/src/backends/meta-gpu.c +++ b/src/backends/meta-gpu.c @@ -65,8 +65,8 @@ meta_gpu_has_hotplug_mode_update (MetaGpu *gpu) } gboolean -meta_gpu_read_current (MetaGpu *gpu, - GError **error) +meta_gpu_read_current (MetaGpu *gpu, + GError **error) { MetaGpuPrivate *priv = meta_gpu_get_instance_private (gpu); gboolean ret; @@ -131,7 +131,7 @@ meta_gpu_take_outputs (MetaGpu *gpu, void meta_gpu_take_crtcs (MetaGpu *gpu, - GList *crtcs) + GList *crtcs) { MetaGpuPrivate *priv = meta_gpu_get_instance_private (gpu); diff --git a/src/backends/meta-idle-monitor-dbus.c b/src/backends/meta-idle-monitor-dbus.c index e55275be7..94386f7d0 100644 --- a/src/backends/meta-idle-monitor-dbus.c +++ b/src/backends/meta-idle-monitor-dbus.c @@ -65,7 +65,8 @@ handle_reset_idletime (MetaDBusIdleMonitor *skeleton, return TRUE; } -typedef struct { +typedef struct +{ MetaDBusIdleMonitor *dbus_monitor; MetaIdleMonitor *monitor; char *dbus_name; @@ -92,11 +93,14 @@ dbus_idle_callback (MetaIdleMonitor *monitor, gpointer user_data) { DBusWatch *watch = user_data; - GDBusInterfaceSkeleton *skeleton = G_DBUS_INTERFACE_SKELETON (watch->dbus_monitor); + GDBusInterfaceSkeleton *skeleton = G_DBUS_INTERFACE_SKELETON ( + watch->dbus_monitor); - g_dbus_connection_emit_signal (g_dbus_interface_skeleton_get_connection (skeleton), + g_dbus_connection_emit_signal (g_dbus_interface_skeleton_get_connection ( + skeleton), watch->dbus_name, - g_dbus_interface_skeleton_get_object_path (skeleton), + g_dbus_interface_skeleton_get_object_path ( + skeleton), "org.gnome.Mutter.IdleMonitor", "WatchFired", g_variant_new ("(u)", watch_id), @@ -123,8 +127,10 @@ make_dbus_watch (MetaDBusIdleMonitor *skeleton, watch = g_slice_new (DBusWatch); watch->dbus_monitor = g_object_ref (skeleton); watch->monitor = g_object_ref (monitor); - watch->dbus_name = g_strdup (g_dbus_method_invocation_get_sender (invocation)); - watch->name_watcher_id = g_bus_watch_name_on_connection (g_dbus_method_invocation_get_connection (invocation), + watch->dbus_name = + g_strdup (g_dbus_method_invocation_get_sender (invocation)); + watch->name_watcher_id = g_bus_watch_name_on_connection (g_dbus_method_invocation_get_connection ( + invocation), watch->dbus_name, G_BUS_NAME_WATCHER_FLAGS_NONE, NULL, /* appeared */ @@ -144,9 +150,11 @@ handle_add_idle_watch (MetaDBusIdleMonitor *skeleton, watch = make_dbus_watch (skeleton, invocation, monitor); watch->watch_id = meta_idle_monitor_add_idle_watch (monitor, interval, - dbus_idle_callback, watch, destroy_dbus_watch); + dbus_idle_callback, watch, + destroy_dbus_watch); - meta_dbus_idle_monitor_complete_add_idle_watch (skeleton, invocation, watch->watch_id); + meta_dbus_idle_monitor_complete_add_idle_watch (skeleton, invocation, + watch->watch_id); return TRUE; } @@ -160,10 +168,12 @@ handle_add_user_active_watch (MetaDBusIdleMonitor *skeleton, watch = make_dbus_watch (skeleton, invocation, monitor); watch->watch_id = meta_idle_monitor_add_user_active_watch (monitor, - dbus_idle_callback, watch, + dbus_idle_callback, + watch, destroy_dbus_watch); - meta_dbus_idle_monitor_complete_add_user_active_watch (skeleton, invocation, watch->watch_id); + meta_dbus_idle_monitor_complete_add_user_active_watch (skeleton, invocation, + watch->watch_id); return TRUE; } @@ -192,7 +202,8 @@ create_monitor_skeleton (GDBusObjectManagerServer *manager, g_signal_connect_object (skeleton, "handle-add-idle-watch", G_CALLBACK (handle_add_idle_watch), monitor, 0); g_signal_connect_object (skeleton, "handle-add-user-active-watch", - G_CALLBACK (handle_add_user_active_watch), monitor, 0); + G_CALLBACK (handle_add_user_active_watch), monitor, + 0); g_signal_connect_object (skeleton, "handle-remove-watch", G_CALLBACK (handle_remove_watch), monitor, 0); g_signal_connect_object (skeleton, "handle-reset-idletime", @@ -203,7 +214,8 @@ create_monitor_skeleton (GDBusObjectManagerServer *manager, object = meta_dbus_object_skeleton_new (path); meta_dbus_object_skeleton_set_idle_monitor (object, skeleton); - g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object)); + g_dbus_object_manager_server_export (manager, + G_DBUS_OBJECT_SKELETON (object)); g_object_unref (skeleton); g_object_unref (object); @@ -214,7 +226,6 @@ on_device_added (ClutterDeviceManager *device_manager, ClutterInputDevice *device, GDBusObjectManagerServer *manager) { - MetaIdleMonitor *monitor; int device_id; char *path; @@ -254,8 +265,9 @@ on_bus_acquired (GDBusConnection *connection, manager = g_dbus_object_manager_server_new ("/org/gnome/Mutter/IdleMonitor"); - /* We never clear the core monitor, as that's supposed to cumulate idle times from - all devices */ + /* We never clear the core monitor, as that's supposed to cumulate idle times + * from + * all devices */ monitor = meta_idle_monitor_get_core (); path = g_strdup ("/org/gnome/Mutter/IdleMonitor/Core"); create_monitor_skeleton (manager, monitor, path); diff --git a/src/backends/meta-idle-monitor.c b/src/backends/meta-idle-monitor.c index 6673fe06c..dc3737b1f 100644 --- a/src/backends/meta-idle-monitor.c +++ b/src/backends/meta-idle-monitor.c @@ -41,7 +41,7 @@ #include "meta/meta-idle-monitor.h" #include "meta/util.h" -G_STATIC_ASSERT(sizeof(unsigned long) == sizeof(gpointer)); +G_STATIC_ASSERT (sizeof (unsigned long) == sizeof (gpointer)); enum { @@ -149,8 +149,10 @@ meta_idle_monitor_class_init (MetaIdleMonitorClass *klass) "Device ID", "The device to listen to idletime on", 0, 255, 0, - G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); - g_object_class_install_property (object_class, PROP_DEVICE_ID, obj_props[PROP_DEVICE_ID]); + G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY); + g_object_class_install_property (object_class, PROP_DEVICE_ID, + obj_props[PROP_DEVICE_ID]); } static void @@ -213,15 +215,16 @@ update_inhibited (MetaIdleMonitor *monitor, } static void -meta_idle_monitor_inhibited_actions_changed (GDBusProxy *session, - GVariant *changed, - char **invalidated, - gpointer user_data) +meta_idle_monitor_inhibited_actions_changed (GDBusProxy *session, + GVariant *changed, + char **invalidated, + gpointer user_data) { MetaIdleMonitor *monitor = user_data; GVariant *v; - v = g_variant_lookup_value (changed, "InhibitedActions", G_VARIANT_TYPE_UINT32); + v = + g_variant_lookup_value (changed, "InhibitedActions", G_VARIANT_TYPE_UINT32); if (v) { gboolean inhibited; @@ -311,9 +314,9 @@ get_next_watch_serial (void) } static gboolean -idle_monitor_dispatch_timeout (GSource *source, - GSourceFunc callback, - gpointer user_data) +idle_monitor_dispatch_timeout (GSource *source, + GSourceFunc callback, + gpointer user_data) { MetaIdleMonitorWatch *watch = (MetaIdleMonitorWatch *) user_data; @@ -323,7 +326,8 @@ idle_monitor_dispatch_timeout (GSource *source, return TRUE; } -static GSourceFuncs idle_monitor_source_funcs = { +static GSourceFuncs idle_monitor_source_funcs = +{ .prepare = NULL, .check = NULL, .dispatch = idle_monitor_dispatch_timeout, @@ -331,11 +335,11 @@ static GSourceFuncs idle_monitor_source_funcs = { }; static MetaIdleMonitorWatch * -make_watch (MetaIdleMonitor *monitor, - guint64 timeout_msec, - MetaIdleMonitorWatchFunc callback, - gpointer user_data, - GDestroyNotify notify) +make_watch (MetaIdleMonitor *monitor, + guint64 timeout_msec, + MetaIdleMonitorWatchFunc callback, + gpointer user_data, + GDestroyNotify notify) { MetaIdleMonitorWatch *watch; @@ -395,11 +399,11 @@ make_watch (MetaIdleMonitor *monitor, * meta_idle_monitor_add_user_active_watch(). */ guint -meta_idle_monitor_add_idle_watch (MetaIdleMonitor *monitor, - guint64 interval_msec, - MetaIdleMonitorWatchFunc callback, - gpointer user_data, - GDestroyNotify notify) +meta_idle_monitor_add_idle_watch (MetaIdleMonitor *monitor, + guint64 interval_msec, + MetaIdleMonitorWatchFunc callback, + gpointer user_data, + GDestroyNotify notify) { MetaIdleMonitorWatch *watch; @@ -432,10 +436,10 @@ meta_idle_monitor_add_idle_watch (MetaIdleMonitor *monitor, * meta_idle_monitor_add_idle_watch(), has triggered. */ guint -meta_idle_monitor_add_user_active_watch (MetaIdleMonitor *monitor, - MetaIdleMonitorWatchFunc callback, - gpointer user_data, - GDestroyNotify notify) +meta_idle_monitor_add_user_active_watch (MetaIdleMonitor *monitor, + MetaIdleMonitorWatchFunc callback, + gpointer user_data, + GDestroyNotify notify) { MetaIdleMonitorWatch *watch; @@ -461,7 +465,7 @@ meta_idle_monitor_add_user_active_watch (MetaIdleMonitor *monitor, */ void meta_idle_monitor_remove_watch (MetaIdleMonitor *monitor, - guint id) + guint id) { g_return_if_fail (META_IS_IDLE_MONITOR (monitor)); diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c index 1d1a9ae35..998619bae 100644 --- a/src/backends/meta-input-settings.c +++ b/src/backends/meta-input-settings.c @@ -90,7 +90,8 @@ struct _MetaInputSettingsPrivate GHashTable *two_finger_devices; /* Pad ring/strip emission */ - struct { + struct + { ClutterInputDevice *pad; MetaPadActionType action; guint number; @@ -108,7 +109,8 @@ typedef void (*ConfigUintFunc) (MetaInputSettings *input_settings, ClutterInputDevice *device, guint value); -typedef enum { +typedef enum +{ META_PAD_DIRECTION_NONE = -1, META_PAD_DIRECTION_UP = 0, META_PAD_DIRECTION_DOWN, @@ -116,11 +118,12 @@ typedef enum { META_PAD_DIRECTION_CCW, } MetaPadDirection; -G_DEFINE_TYPE_WITH_PRIVATE (MetaInputSettings, meta_input_settings, G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE (MetaInputSettings, meta_input_settings, + G_TYPE_OBJECT) static GSList * -meta_input_settings_get_devices (MetaInputSettings *settings, - ClutterInputDeviceType type) +meta_input_settings_get_devices (MetaInputSettings * settings, + ClutterInputDeviceType type) { MetaInputSettingsPrivate *priv; const GSList *devices; @@ -134,7 +137,8 @@ meta_input_settings_get_devices (MetaInputSettings *settings, ClutterInputDevice *device = devices->data; if (clutter_input_device_get_device_type (device) == type && - clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_MASTER) + clutter_input_device_get_device_mode (device) != + CLUTTER_INPUT_MODE_MASTER) list = g_slist_prepend (list, device); devices = devices->next; @@ -147,7 +151,8 @@ static void meta_input_settings_dispose (GObject *object) { MetaInputSettings *settings = META_INPUT_SETTINGS (object); - MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private (settings); + MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private ( + settings); g_clear_object (&priv->virtual_pad_keyboard); @@ -189,10 +194,10 @@ settings_device_set_bool_setting (MetaInputSettings *input_settings, } static void -settings_set_bool_setting (MetaInputSettings *input_settings, - ClutterInputDeviceType type, - ConfigBoolFunc func, - gboolean enabled) +settings_set_bool_setting (MetaInputSettings *input_settings, + ClutterInputDeviceType type, + ConfigBoolFunc func, + gboolean enabled) { GSList *devices, *d; @@ -214,10 +219,10 @@ settings_device_set_double_setting (MetaInputSettings *input_settings, } static void -settings_set_double_setting (MetaInputSettings *input_settings, - ClutterInputDeviceType type, - ConfigDoubleFunc func, - gdouble value) +settings_set_double_setting (MetaInputSettings *input_settings, + ClutterInputDeviceType type, + ConfigDoubleFunc func, + gdouble value) { GSList *devices, *d; @@ -239,10 +244,10 @@ settings_device_set_uint_setting (MetaInputSettings *input_settings, } static void -settings_set_uint_setting (MetaInputSettings *input_settings, - ClutterInputDeviceType type, - ConfigUintFunc func, - guint value) +settings_set_uint_setting (MetaInputSettings *input_settings, + ClutterInputDeviceType type, + ConfigUintFunc func, + guint value) { GSList *devices, *d; @@ -397,8 +402,8 @@ update_pointer_accel_profile (MetaInputSettings *input_settings, } static GSettings * -get_settings_for_device_type (MetaInputSettings *input_settings, - ClutterInputDeviceType type) +get_settings_for_device_type (MetaInputSettings *input_settings, + ClutterInputDeviceType type) { MetaInputSettingsPrivate *priv; priv = meta_input_settings_get_instance_private (input_settings); @@ -414,8 +419,8 @@ get_settings_for_device_type (MetaInputSettings *input_settings, } static void -update_device_speed (MetaInputSettings *input_settings, - ClutterInputDevice *device) +update_device_speed (MetaInputSettings *input_settings, + ClutterInputDevice *device) { GSettings *settings; ConfigDoubleFunc func; @@ -426,27 +431,32 @@ update_device_speed (MetaInputSettings *input_settings, if (device) { settings = get_settings_for_device_type (input_settings, - clutter_input_device_get_device_type (device)); + clutter_input_device_get_device_type ( + device)); if (!settings) return; settings_device_set_double_setting (input_settings, device, func, - g_settings_get_double (settings, key)); + g_settings_get_double (settings, + key)); } else { - settings = get_settings_for_device_type (input_settings, CLUTTER_POINTER_DEVICE); + settings = get_settings_for_device_type (input_settings, + CLUTTER_POINTER_DEVICE); settings_set_double_setting (input_settings, CLUTTER_POINTER_DEVICE, func, g_settings_get_double (settings, key)); - settings = get_settings_for_device_type (input_settings, CLUTTER_TOUCHPAD_DEVICE); - settings_set_double_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, func, + settings = get_settings_for_device_type (input_settings, + CLUTTER_TOUCHPAD_DEVICE); + settings_set_double_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, + func, g_settings_get_double (settings, key)); } } static void -update_device_natural_scroll (MetaInputSettings *input_settings, - ClutterInputDevice *device) +update_device_natural_scroll (MetaInputSettings *input_settings, + ClutterInputDevice *device) { GSettings *settings; ConfigBoolFunc func; @@ -457,7 +467,8 @@ update_device_natural_scroll (MetaInputSettings *input_settings, if (device) { settings = get_settings_for_device_type (input_settings, - clutter_input_device_get_device_type (device)); + clutter_input_device_get_device_type ( + device)); if (!settings) return; @@ -466,10 +477,12 @@ update_device_natural_scroll (MetaInputSettings *input_settings, } else { - settings = get_settings_for_device_type (input_settings, CLUTTER_POINTER_DEVICE); + settings = get_settings_for_device_type (input_settings, + CLUTTER_POINTER_DEVICE); settings_set_bool_setting (input_settings, CLUTTER_POINTER_DEVICE, func, g_settings_get_boolean (settings, key)); - settings = get_settings_for_device_type (input_settings, CLUTTER_TOUCHPAD_DEVICE); + settings = get_settings_for_device_type (input_settings, + CLUTTER_TOUCHPAD_DEVICE); settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, func, g_settings_get_boolean (settings, key)); } @@ -494,9 +507,10 @@ update_touchpad_disable_while_typing (MetaInputSettings *input_settings, enabled = g_settings_get_boolean (priv->touchpad_settings, key); if (device) - { + { settings = get_settings_for_device_type (input_settings, - clutter_input_device_get_device_type (device)); + clutter_input_device_get_device_type ( + device)); if (!settings) return; @@ -574,7 +588,7 @@ update_touchpad_tap_and_drag_enabled (MetaInputSettings *input_settings, } static void -update_touchpad_edge_scroll (MetaInputSettings *input_settings, +update_touchpad_edge_scroll (MetaInputSettings *input_settings, ClutterInputDevice *device) { MetaInputSettingsClass *input_settings_class; @@ -589,12 +603,16 @@ update_touchpad_edge_scroll (MetaInputSettings *input_settings, priv = meta_input_settings_get_instance_private (input_settings); input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings); - edge_scroll_enabled = g_settings_get_boolean (priv->touchpad_settings, "edge-scrolling-enabled"); - two_finger_scroll_enabled = g_settings_get_boolean (priv->touchpad_settings, "two-finger-scrolling-enabled"); - two_finger_scroll_available = g_hash_table_size (priv->two_finger_devices) > 0; + edge_scroll_enabled = g_settings_get_boolean (priv->touchpad_settings, + "edge-scrolling-enabled"); + two_finger_scroll_enabled = g_settings_get_boolean (priv->touchpad_settings, + "two-finger-scrolling-enabled"); + two_finger_scroll_available = g_hash_table_size (priv->two_finger_devices) > + 0; /* If both are enabled we prefer two finger. */ - if (edge_scroll_enabled && two_finger_scroll_enabled && two_finger_scroll_available) + if (edge_scroll_enabled && two_finger_scroll_enabled && + two_finger_scroll_available) edge_scroll_enabled = FALSE; if (device) @@ -612,7 +630,7 @@ update_touchpad_edge_scroll (MetaInputSettings *input_settings, } static void -update_touchpad_two_finger_scroll (MetaInputSettings *input_settings, +update_touchpad_two_finger_scroll (MetaInputSettings *input_settings, ClutterInputDevice *device) { MetaInputSettingsClass *input_settings_class; @@ -625,7 +643,8 @@ update_touchpad_two_finger_scroll (MetaInputSettings *input_settings, priv = meta_input_settings_get_instance_private (input_settings); input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings); - two_finger_scroll_enabled = g_settings_get_boolean (priv->touchpad_settings, "two-finger-scrolling-enabled"); + two_finger_scroll_enabled = g_settings_get_boolean (priv->touchpad_settings, + "two-finger-scrolling-enabled"); /* Disable edge since they can't both be set. */ if (two_finger_scroll_enabled) @@ -650,7 +669,7 @@ update_touchpad_two_finger_scroll (MetaInputSettings *input_settings, } static void -update_touchpad_click_method (MetaInputSettings *input_settings, +update_touchpad_click_method (MetaInputSettings *input_settings, ClutterInputDevice *device) { MetaInputSettingsClass *input_settings_class; @@ -720,12 +739,14 @@ update_trackball_scroll_button (MetaInputSettings *input_settings, priv = meta_input_settings_get_instance_private (input_settings); input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings); - if (device && !input_settings_class->is_trackball_device (input_settings, device)) + if (device && + !input_settings_class->is_trackball_device (input_settings, device)) return; /* This key is 'i' in the schema but it also specifies a minimum * range of 0 so the cast here is safe. */ - button = (guint) g_settings_get_int (priv->trackball_settings, "scroll-wheel-emulation-button"); + button = (guint) g_settings_get_int (priv->trackball_settings, + "scroll-wheel-emulation-button"); if (device) { @@ -741,8 +762,10 @@ update_trackball_scroll_button (MetaInputSettings *input_settings, { device = devices->data; - if (input_settings_class->is_trackball_device (input_settings, device)) - input_settings_class->set_scroll_button (input_settings, device, button); + if (input_settings_class->is_trackball_device (input_settings, + device)) + input_settings_class->set_scroll_button (input_settings, device, + button); devices = devices->next; } @@ -868,7 +891,8 @@ update_tablet_keep_aspect (MetaInputSettings *input_settings, device); /* Keep aspect only makes sense in external tablets */ if (wacom_device && - libwacom_get_integration_flags (wacom_device) != WACOM_DEVICE_INTEGRATED_NONE) + libwacom_get_integration_flags (wacom_device) != + WACOM_DEVICE_INTEGRATED_NONE) return; } #endif @@ -905,14 +929,16 @@ update_device_display (MetaInputSettings *input_settings, if (clutter_input_device_get_device_type (device) != CLUTTER_TABLET_DEVICE && clutter_input_device_get_device_type (device) != CLUTTER_PEN_DEVICE && clutter_input_device_get_device_type (device) != CLUTTER_ERASER_DEVICE && - clutter_input_device_get_device_type (device) != CLUTTER_TOUCHSCREEN_DEVICE) + clutter_input_device_get_device_type (device) != + CLUTTER_TOUCHSCREEN_DEVICE) return; priv = meta_input_settings_get_instance_private (input_settings); input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings); /* If mapping is relative, the device can move on all displays */ - if (clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE || + if (clutter_input_device_get_device_type (device) == + CLUTTER_TOUCHSCREEN_DEVICE || clutter_input_device_get_mapping_mode (device) == CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE) meta_input_settings_find_monitor (input_settings, settings, device, @@ -949,7 +975,8 @@ update_tablet_mapping (MetaInputSettings *input_settings, device); /* Tablet mapping only makes sense on external tablets */ if (wacom_device && - (libwacom_get_integration_flags (wacom_device) != WACOM_DEVICE_INTEGRATED_NONE)) + (libwacom_get_integration_flags (wacom_device) != + WACOM_DEVICE_INTEGRATED_NONE)) return; } #endif @@ -990,7 +1017,8 @@ update_tablet_area (MetaInputSettings *input_settings, /* Tablet area only makes sense on system/display integrated tablets */ if (wacom_device && (libwacom_get_integration_flags (wacom_device) & - (WACOM_DEVICE_INTEGRATED_SYSTEM | WACOM_DEVICE_INTEGRATED_DISPLAY)) == 0) + (WACOM_DEVICE_INTEGRATED_SYSTEM | WACOM_DEVICE_INTEGRATED_DISPLAY)) == + 0) return; } #endif @@ -1031,7 +1059,8 @@ update_tablet_left_handed (MetaInputSettings *input_settings, device); /* Left handed mode only makes sense on external tablets */ if (wacom_device && - (libwacom_get_integration_flags (wacom_device) != WACOM_DEVICE_INTEGRATED_NONE)) + (libwacom_get_integration_flags (wacom_device) != + WACOM_DEVICE_INTEGRATED_NONE)) return; } #endif @@ -1050,7 +1079,8 @@ meta_input_settings_changed_cb (GSettings *settings, gpointer user_data) { MetaInputSettings *input_settings = META_INPUT_SETTINGS (user_data); - MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private (input_settings); + MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private ( + input_settings); if (settings == priv->mouse_settings) { @@ -1075,7 +1105,7 @@ meta_input_settings_changed_cb (GSettings *settings, update_touchpad_tap_enabled (input_settings, NULL); else if (strcmp (key, "tap-and-drag") == 0) update_touchpad_tap_and_drag_enabled (input_settings, NULL); - else if (strcmp(key, "disable-while-typing") == 0) + else if (strcmp (key, "disable-while-typing") == 0) update_touchpad_disable_while_typing (input_settings, NULL); else if (strcmp (key, "send-events") == 0) update_touchpad_send_events (input_settings, NULL); @@ -1140,23 +1170,25 @@ apply_mappable_device_settings (MetaInputSettings *input_settings, } } -struct _a11y_settings_flags_pair { +struct _a11y_settings_flags_pair +{ const char *name; ClutterKeyboardA11yFlags flag; -} settings_flags_pair[] = { - { "enable", CLUTTER_A11Y_KEYBOARD_ENABLED }, - { "timeout-enable", CLUTTER_A11Y_TIMEOUT_ENABLED }, - { "mousekeys-enable", CLUTTER_A11Y_MOUSE_KEYS_ENABLED }, - { "slowkeys-enable", CLUTTER_A11Y_SLOW_KEYS_ENABLED }, - { "slowkeys-beep-press", CLUTTER_A11Y_SLOW_KEYS_BEEP_PRESS }, - { "slowkeys-beep-accept", CLUTTER_A11Y_SLOW_KEYS_BEEP_ACCEPT }, - { "slowkeys-beep-reject", CLUTTER_A11Y_SLOW_KEYS_BEEP_REJECT }, - { "bouncekeys-enable", CLUTTER_A11Y_BOUNCE_KEYS_ENABLED }, - { "bouncekeys-beep-reject", CLUTTER_A11Y_BOUNCE_KEYS_BEEP_REJECT }, - { "togglekeys-enable", CLUTTER_A11Y_TOGGLE_KEYS_ENABLED }, - { "stickykeys-enable", CLUTTER_A11Y_STICKY_KEYS_ENABLED }, - { "stickykeys-modifier-beep", CLUTTER_A11Y_STICKY_KEYS_BEEP }, - { "stickykeys-two-key-off", CLUTTER_A11Y_STICKY_KEYS_TWO_KEY_OFF }, +} settings_flags_pair[] = +{ + { "enable", CLUTTER_A11Y_KEYBOARD_ENABLED }, + { "timeout-enable", CLUTTER_A11Y_TIMEOUT_ENABLED }, + { "mousekeys-enable", CLUTTER_A11Y_MOUSE_KEYS_ENABLED }, + { "slowkeys-enable", CLUTTER_A11Y_SLOW_KEYS_ENABLED }, + { "slowkeys-beep-press", CLUTTER_A11Y_SLOW_KEYS_BEEP_PRESS }, + { "slowkeys-beep-accept", CLUTTER_A11Y_SLOW_KEYS_BEEP_ACCEPT }, + { "slowkeys-beep-reject", CLUTTER_A11Y_SLOW_KEYS_BEEP_REJECT }, + { "bouncekeys-enable", CLUTTER_A11Y_BOUNCE_KEYS_ENABLED }, + { "bouncekeys-beep-reject", CLUTTER_A11Y_BOUNCE_KEYS_BEEP_REJECT }, + { "togglekeys-enable", CLUTTER_A11Y_TOGGLE_KEYS_ENABLED }, + { "stickykeys-enable", CLUTTER_A11Y_STICKY_KEYS_ENABLED }, + { "stickykeys-modifier-beep", CLUTTER_A11Y_STICKY_KEYS_BEEP }, + { "stickykeys-two-key-off", CLUTTER_A11Y_STICKY_KEYS_TWO_KEY_OFF }, { "feature-state-change-beep", CLUTTER_A11Y_FEATURE_STATE_CHANGE_BEEP }, }; @@ -1164,19 +1196,22 @@ static void load_keyboard_a11y_settings (MetaInputSettings *input_settings, ClutterInputDevice *device) { - MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private (input_settings); + MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private ( + input_settings); ClutterKbdA11ySettings kbd_a11y_settings; ClutterInputDevice *core_keyboard; guint i; - core_keyboard = clutter_device_manager_get_core_device (priv->device_manager, CLUTTER_KEYBOARD_DEVICE); + core_keyboard = clutter_device_manager_get_core_device (priv->device_manager, + CLUTTER_KEYBOARD_DEVICE); if (device && device != core_keyboard) return; kbd_a11y_settings.controls = 0; for (i = 0; i < G_N_ELEMENTS (settings_flags_pair); i++) { - if (g_settings_get_boolean (priv->a11y_settings, settings_flags_pair[i].name)) + if (g_settings_get_boolean (priv->a11y_settings, + settings_flags_pair[i].name)) kbd_a11y_settings.controls |= settings_flags_pair[i].flag; } @@ -1186,14 +1221,18 @@ load_keyboard_a11y_settings (MetaInputSettings *input_settings, "slowkeys-delay"); kbd_a11y_settings.debounce_delay = g_settings_get_int (priv->a11y_settings, "bouncekeys-delay"); - kbd_a11y_settings.mousekeys_init_delay = g_settings_get_int (priv->a11y_settings, - "mousekeys-init-delay"); - kbd_a11y_settings.mousekeys_max_speed = g_settings_get_int (priv->a11y_settings, - "mousekeys-max-speed"); - kbd_a11y_settings.mousekeys_accel_time = g_settings_get_int (priv->a11y_settings, - "mousekeys-accel-time"); + kbd_a11y_settings.mousekeys_init_delay = g_settings_get_int ( + priv->a11y_settings, + "mousekeys-init-delay"); + kbd_a11y_settings.mousekeys_max_speed = g_settings_get_int ( + priv->a11y_settings, + "mousekeys-max-speed"); + kbd_a11y_settings.mousekeys_accel_time = g_settings_get_int ( + priv->a11y_settings, + "mousekeys-accel-time"); - clutter_device_manager_set_kbd_a11y_settings (priv->device_manager, &kbd_a11y_settings); + clutter_device_manager_set_kbd_a11y_settings (priv->device_manager, + &kbd_a11y_settings); } static void @@ -1202,7 +1241,8 @@ on_keyboard_a11y_settings_changed (ClutterDeviceManager *device_manager, ClutterKeyboardA11yFlags what_changed, MetaInputSettings *input_settings) { - MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private (input_settings); + MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private ( + input_settings); guint i; for (i = 0; i < G_N_ELEMENTS (settings_flags_pair); i++) @@ -1210,7 +1250,8 @@ on_keyboard_a11y_settings_changed (ClutterDeviceManager *device_manager, if (settings_flags_pair[i].flag & what_changed) g_settings_set_boolean (priv->a11y_settings, settings_flags_pair[i].name, - (new_flags & settings_flags_pair[i].flag) ? TRUE : FALSE); + (new_flags & + settings_flags_pair[i].flag) ? TRUE : FALSE); } } @@ -1278,13 +1319,15 @@ lookup_tool_settings (ClutterInputDeviceTool *tool, if (serial == 0) { - path = g_strdup_printf ("/org/gnome/desktop/peripherals/stylus/default-%s:%s/", - clutter_input_device_get_vendor_id (device), - clutter_input_device_get_product_id (device)); + path = g_strdup_printf ( + "/org/gnome/desktop/peripherals/stylus/default-%s:%s/", + clutter_input_device_get_vendor_id (device), + clutter_input_device_get_product_id (device)); } else { - path = g_strdup_printf ("/org/gnome/desktop/peripherals/stylus/%lx/", serial); + path = g_strdup_printf ("/org/gnome/desktop/peripherals/stylus/%lx/", + serial); } tool_settings = @@ -1336,7 +1379,8 @@ lookup_pad_action_settings (ClutterInputDevice *device, } path = g_string_new (NULL); - g_string_append_printf (path, "/org/gnome/desktop/peripherals/tablets/%s:%s/%s%c", + g_string_append_printf (path, + "/org/gnome/desktop/peripherals/tablets/%s:%s/%s%c", vendor, product, action_type, action_label); if (detail_type) @@ -1347,8 +1391,9 @@ lookup_pad_action_settings (ClutterInputDevice *device, g_string_append_c (path, '/'); - settings = g_settings_new_with_path ("org.gnome.desktop.peripherals.tablet.pad-button", - path->str); + settings = g_settings_new_with_path ( + "org.gnome.desktop.peripherals.tablet.pad-button", + path->str); g_string_free (path, TRUE); return settings; @@ -1421,7 +1466,8 @@ check_add_mappable_device (MetaInputSettings *input_settings, WacomError *error = libwacom_error_new (); info->wacom_device = libwacom_new_from_path (priv->wacom_db, - clutter_input_device_get_device_node (device), + clutter_input_device_get_device_node ( + device), WFALLBACK_NONE, error); if (!info->wacom_device) { @@ -1514,7 +1560,8 @@ update_stylus_pressure (MetaInputSettings *input_settings, return; input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings); - input_settings_class->set_stylus_pressure (input_settings, device, tool, curve); + input_settings_class->set_stylus_pressure (input_settings, device, tool, + curve); } static void @@ -1576,7 +1623,8 @@ meta_input_settings_device_added (ClutterDeviceManager *device_manager, ClutterInputDevice *device, MetaInputSettings *input_settings) { - if (clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_MASTER) + if (clutter_input_device_get_device_mode (device) == + CLUTTER_INPUT_MODE_MASTER) return; evaluate_two_finger_scrolling (input_settings, device); @@ -1674,7 +1722,8 @@ check_mappable_devices (MetaInputSettings *input_settings) { ClutterInputDevice *device = l->data; - if (clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_MASTER) + if (clutter_input_device_get_device_mode (device) == + CLUTTER_INPUT_MODE_MASTER) continue; check_add_mappable_device (input_settings, device); @@ -1687,7 +1736,8 @@ meta_input_settings_constructed (GObject *object) MetaInputSettings *input_settings = META_INPUT_SETTINGS (object); GSList *devices, *d; - devices = meta_input_settings_get_devices (input_settings, CLUTTER_TOUCHPAD_DEVICE); + devices = meta_input_settings_get_devices (input_settings, + CLUTTER_TOUCHPAD_DEVICE); for (d = devices; d; d = d->next) evaluate_two_finger_scrolling (input_settings, d->data); @@ -1728,22 +1778,26 @@ meta_input_settings_init (MetaInputSettings *settings) g_signal_connect (priv->mouse_settings, "changed", G_CALLBACK (meta_input_settings_changed_cb), settings); - priv->touchpad_settings = g_settings_new ("org.gnome.desktop.peripherals.touchpad"); + priv->touchpad_settings = g_settings_new ( + "org.gnome.desktop.peripherals.touchpad"); g_signal_connect (priv->touchpad_settings, "changed", G_CALLBACK (meta_input_settings_changed_cb), settings); - priv->trackball_settings = g_settings_new ("org.gnome.desktop.peripherals.trackball"); + priv->trackball_settings = g_settings_new ( + "org.gnome.desktop.peripherals.trackball"); g_signal_connect (priv->trackball_settings, "changed", G_CALLBACK (meta_input_settings_changed_cb), settings); - priv->keyboard_settings = g_settings_new ("org.gnome.desktop.peripherals.keyboard"); + priv->keyboard_settings = g_settings_new ( + "org.gnome.desktop.peripherals.keyboard"); g_signal_connect (priv->keyboard_settings, "changed", G_CALLBACK (meta_input_settings_changed_cb), settings); - priv->gsd_settings = g_settings_new ("org.gnome.settings-daemon.peripherals.mouse"); + priv->gsd_settings = g_settings_new ( + "org.gnome.settings-daemon.peripherals.mouse"); g_settings_bind (priv->gsd_settings, "double-click", - clutter_settings_get_default(), "double-click-time", + clutter_settings_get_default (), "double-click-time", G_SETTINGS_BIND_GET); priv->a11y_settings = g_settings_new ("org.gnome.desktop.a11y.keyboard"); @@ -1753,10 +1807,12 @@ meta_input_settings_init (MetaInputSettings *settings) G_CALLBACK (on_keyboard_a11y_settings_changed), settings); priv->mappable_devices = - g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) device_mapping_info_free); + g_hash_table_new_full (NULL, NULL, NULL, + (GDestroyNotify) device_mapping_info_free); priv->current_tools = - g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) current_tool_info_free); + g_hash_table_new_full (NULL, NULL, NULL, + (GDestroyNotify) current_tool_info_free); priv->monitor_manager = g_object_ref (meta_monitor_manager_get ()); g_signal_connect (priv->monitor_manager, "monitors-changed-internal", @@ -1831,9 +1887,9 @@ meta_input_settings_get_tablet_mapping (MetaInputSettings *settings, } static GDesktopPadButtonAction -meta_input_settings_get_pad_button_action (MetaInputSettings *input_settings, - ClutterInputDevice *pad, - guint button) +meta_input_settings_get_pad_button_action (MetaInputSettings *input_settings, + ClutterInputDevice *pad, + guint button) { GDesktopPadButtonAction action; GSettings *settings; @@ -1853,7 +1909,7 @@ meta_input_settings_get_pad_button_action (MetaInputSettings *input_settings, #ifdef HAVE_LIBWACOM WacomDevice * -meta_input_settings_get_tablet_wacom_device (MetaInputSettings *settings, +meta_input_settings_get_tablet_wacom_device (MetaInputSettings *settings, ClutterInputDevice *device) { MetaInputSettingsPrivate *priv; @@ -1917,8 +1973,10 @@ meta_input_settings_cycle_tablet_output (MetaInputSettings *input_settings, g_return_if_fail (META_IS_INPUT_SETTINGS (input_settings)); g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device)); - g_return_if_fail (clutter_input_device_get_device_type (device) == CLUTTER_TABLET_DEVICE || - clutter_input_device_get_device_type (device) == CLUTTER_PAD_DEVICE); + g_return_if_fail (clutter_input_device_get_device_type ( + device) == CLUTTER_TABLET_DEVICE || + clutter_input_device_get_device_type ( + device) == CLUTTER_PAD_DEVICE); priv = meta_input_settings_get_instance_private (input_settings); info = g_hash_table_lookup (priv->mappable_devices, device); @@ -1928,7 +1986,8 @@ meta_input_settings_cycle_tablet_output (MetaInputSettings *input_settings, if (info->wacom_device) { /* Output rotation only makes sense on external tablets */ - if (libwacom_get_integration_flags (info->wacom_device) != WACOM_DEVICE_INTEGRATED_NONE) + if (libwacom_get_integration_flags (info->wacom_device) != + WACOM_DEVICE_INTEGRATED_NONE) return; pretty_name = libwacom_get_name (info->wacom_device); @@ -1971,10 +2030,12 @@ emulate_modifiers (ClutterVirtualInputDevice *device, ClutterKeyState state) { guint i; - struct { + struct + { ClutterModifierType mod; guint keyval; - } mod_map[] = { + } mod_map[] = + { { CLUTTER_SHIFT_MASK, CLUTTER_KEY_Shift_L }, { CLUTTER_CONTROL_MASK, CLUTTER_KEY_Control_L }, { CLUTTER_MOD1_MASK, CLUTTER_KEY_Meta_L } @@ -1992,9 +2053,9 @@ emulate_modifiers (ClutterVirtualInputDevice *device, } static void -meta_input_settings_emulate_keybinding (MetaInputSettings *input_settings, - const gchar *accel, - gboolean is_press) +meta_input_settings_emulate_keybinding (MetaInputSettings *input_settings, + const gchar *accel, + gboolean is_press) { MetaInputSettingsPrivate *priv; ClutterKeyState state; @@ -2039,14 +2100,16 @@ meta_input_settings_is_pad_button_grabbed (MetaInputSettings *input_settings, g_return_val_if_fail (clutter_input_device_get_device_type (pad) == CLUTTER_PAD_DEVICE, FALSE); - return (meta_input_settings_get_pad_button_action (input_settings, pad, button) != + return (meta_input_settings_get_pad_button_action (input_settings, pad, + button) != G_DESKTOP_PAD_BUTTON_ACTION_NONE); } static gboolean -meta_input_settings_handle_pad_button (MetaInputSettings *input_settings, - ClutterInputDevice *pad, - const ClutterPadButtonEvent *event) +meta_input_settings_handle_pad_button ( + MetaInputSettings *input_settings, + ClutterInputDevice *pad, + const ClutterPadButtonEvent *event) { GDesktopPadButtonAction action; gint button, group, mode; @@ -2082,7 +2145,8 @@ meta_input_settings_handle_pad_button (MetaInputSettings *input_settin info->group_modes[group] = mode; } - action = meta_input_settings_get_pad_button_action (input_settings, pad, button); + action = meta_input_settings_get_pad_button_action (input_settings, pad, + button); switch (action) { @@ -2096,7 +2160,8 @@ meta_input_settings_handle_pad_button (MetaInputSettings *input_settin return TRUE; case G_DESKTOP_PAD_BUTTON_ACTION_KEYBINDING: settings = lookup_pad_action_settings (pad, META_PAD_ACTION_BUTTON, - button, META_PAD_DIRECTION_NONE, -1); + button, META_PAD_DIRECTION_NONE, + -1); accel = g_settings_get_string (settings, "keybinding"); meta_input_settings_emulate_keybinding (input_settings, accel, is_press); g_object_unref (settings); @@ -2109,12 +2174,12 @@ meta_input_settings_handle_pad_button (MetaInputSettings *input_settin } static gboolean -meta_input_settings_handle_pad_action (MetaInputSettings *input_settings, - ClutterInputDevice *pad, - MetaPadActionType action, - guint number, - MetaPadDirection direction, - guint mode) +meta_input_settings_handle_pad_action (MetaInputSettings *input_settings, + ClutterInputDevice *pad, + MetaPadActionType action, + guint number, + MetaPadDirection direction, + guint mode) { GSettings *settings; gboolean handled = FALSE; @@ -2137,9 +2202,10 @@ meta_input_settings_handle_pad_action (MetaInputSettings *input_settings } static gboolean -meta_input_settings_get_pad_action_direction (MetaInputSettings *input_settings, - const ClutterEvent *event, - MetaPadDirection *direction) +meta_input_settings_get_pad_action_direction ( + MetaInputSettings *input_settings, + const ClutterEvent *event, + MetaPadDirection *direction) { MetaInputSettingsPrivate *priv; ClutterInputDevice *pad = clutter_event_get_device (event); @@ -2178,7 +2244,7 @@ meta_input_settings_get_pad_action_direction (MetaInputSettings *input_settings value >= 0 && priv->last_pad_action_info.value >= 0) { *direction = (value - priv->last_pad_action_info.value) > 0 ? - inc_dir : dec_dir; + inc_dir : dec_dir; has_direction = TRUE; } @@ -2310,22 +2376,24 @@ meta_input_settings_get_button_label (MetaInputSettings *input_settings, return g_strdup_printf (_("Mode Switch (Group %d)"), group); } - action = meta_input_settings_get_pad_button_action (input_settings, pad, button); + action = meta_input_settings_get_pad_button_action (input_settings, pad, + button); switch (action) { case G_DESKTOP_PAD_BUTTON_ACTION_KEYBINDING: - { - GSettings *settings; - gchar *accel; + { + GSettings *settings; + gchar *accel; - settings = lookup_pad_action_settings (pad, META_PAD_ACTION_BUTTON, - button, META_PAD_DIRECTION_NONE, -1); - accel = g_settings_get_string (settings, "keybinding"); - g_object_unref (settings); + settings = lookup_pad_action_settings (pad, META_PAD_ACTION_BUTTON, + button, META_PAD_DIRECTION_NONE, + -1); + accel = g_settings_get_string (settings, "keybinding"); + g_object_unref (settings); - return accel; - } + return accel; + } case G_DESKTOP_PAD_BUTTON_ACTION_SWITCH_MONITOR: /* TRANSLATORS: This string refers to an action, cycles drawing tablets' * mapping through the available outputs. diff --git a/src/backends/meta-logical-monitor.c b/src/backends/meta-logical-monitor.c index 1b6151638..e6596eee8 100644 --- a/src/backends/meta-logical-monitor.c +++ b/src/backends/meta-logical-monitor.c @@ -30,8 +30,8 @@ G_DEFINE_TYPE (MetaLogicalMonitor, meta_logical_monitor, G_TYPE_OBJECT) static MetaMonitor * -get_first_monitor (MetaMonitorManager *monitor_manager, - GList *monitor_configs) +get_first_monitor (MetaMonitorManager * monitor_manager, + GList * monitor_configs) { MetaMonitorConfig *first_monitor_config; MetaMonitorSpec *first_monitor_spec; @@ -89,9 +89,9 @@ meta_logical_monitor_new (MetaMonitorManager *monitor_manager, logical_monitor->is_presentation = TRUE; g_list_foreach (monitor_configs, (GFunc) add_monitor_from_config, &(AddMonitorFromConfigData) { - .monitor_manager = monitor_manager, - .logical_monitor = logical_monitor - }); + .monitor_manager = monitor_manager, + .logical_monitor = logical_monitor + }); return logical_monitor; } @@ -240,7 +240,8 @@ meta_logical_monitor_foreach_crtc (MetaLogicalMonitor *logical_monitor, { MetaMonitor *monitor = l->data; MetaMonitorMode *mode; - ForeachCrtcData data = { + ForeachCrtcData data = + { .logical_monitor = logical_monitor, .func = func, .user_data = user_data @@ -279,9 +280,9 @@ meta_logical_monitor_class_init (MetaLogicalMonitorClass *klass) } gboolean -meta_logical_monitor_has_neighbor (MetaLogicalMonitor *logical_monitor, - MetaLogicalMonitor *neighbor, - MetaDisplayDirection neighbor_direction) +meta_logical_monitor_has_neighbor (MetaLogicalMonitor *logical_monitor, + MetaLogicalMonitor *neighbor, + MetaDisplayDirection neighbor_direction) { switch (neighbor_direction) { diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c index a3e92f2e7..3a1bae911 100644 --- a/src/backends/meta-monitor-config-manager.c +++ b/src/backends/meta-monitor-config-manager.c @@ -330,14 +330,15 @@ meta_monitor_config_manager_assign (MetaMonitorManager *manager, static gboolean is_lid_closed (MetaMonitorManager *monitor_manager) { - MetaBackend *backend; + MetaBackend *backend; - backend = meta_monitor_manager_get_backend (monitor_manager); - return meta_backend_is_lid_closed (backend); + backend = meta_monitor_manager_get_backend (monitor_manager); + return meta_backend_is_lid_closed (backend); } MetaMonitorsConfigKey * -meta_create_monitors_config_key_for_current_state (MetaMonitorManager *monitor_manager) +meta_create_monitors_config_key_for_current_state ( + MetaMonitorManager *monitor_manager) { MetaMonitorsConfigKey *config_key; GList *l; @@ -399,7 +400,8 @@ meta_monitor_config_manager_get_stored (MetaMonitorConfigManager *config_manager g_warning ("Failed to finish monitors config migration: %s", error->message); g_error_free (error); - meta_monitor_config_store_remove (config_manager->config_store, config); + meta_monitor_config_store_remove (config_manager->config_store, + config); return NULL; } } @@ -414,8 +416,9 @@ typedef enum _MonitorMatchRule } MonitorMatchRule; static MetaMonitor * -find_monitor_with_highest_preferred_resolution (MetaMonitorManager *monitor_manager, - MonitorMatchRule match_rule) +find_monitor_with_highest_preferred_resolution ( + MetaMonitorManager *monitor_manager, + MonitorMatchRule match_rule) { GList *monitors; GList *l; @@ -517,12 +520,13 @@ create_monitor_config (MetaMonitor *monitor, } static MetaLogicalMonitorConfig * -create_preferred_logical_monitor_config (MetaMonitorManager *monitor_manager, - MetaMonitor *monitor, - int x, - int y, - MetaLogicalMonitorConfig *primary_logical_monitor_config, - MetaLogicalMonitorLayoutMode layout_mode) +create_preferred_logical_monitor_config ( + MetaMonitorManager *monitor_manager, + MetaMonitor *monitor, + int x, + int y, + MetaLogicalMonitorConfig *primary_logical_monitor_config, + MetaLogicalMonitorLayoutMode layout_mode) { MetaMonitorMode *mode; int width, height; @@ -570,7 +574,8 @@ create_preferred_logical_monitor_config (MetaMonitorManager *monitor_ma } MetaMonitorsConfig * -meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_manager) +meta_monitor_config_manager_create_linear ( + MetaMonitorConfigManager *config_manager) { MetaMonitorManager *monitor_manager = config_manager->monitor_manager; GList *logical_monitor_configs; @@ -630,7 +635,8 @@ meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_mana } MetaMonitorsConfig * -meta_monitor_config_manager_create_fallback (MetaMonitorConfigManager *config_manager) +meta_monitor_config_manager_create_fallback ( + MetaMonitorConfigManager *config_manager) { MetaMonitorManager *monitor_manager = config_manager->monitor_manager; MetaMonitor *primary_monitor; @@ -661,7 +667,8 @@ meta_monitor_config_manager_create_fallback (MetaMonitorConfigManager *config_ma } MetaMonitorsConfig * -meta_monitor_config_manager_create_suggested (MetaMonitorConfigManager *config_manager) +meta_monitor_config_manager_create_suggested ( + MetaMonitorConfigManager *config_manager) { MetaMonitorManager *monitor_manager = config_manager->monitor_manager; MetaLogicalMonitorConfig *primary_logical_monitor_config = NULL; @@ -717,7 +724,8 @@ meta_monitor_config_manager_create_suggested (MetaMonitorConfigManager *config_m if (meta_rectangle_overlaps_with_region (region, &logical_monitor_config->layout)) { - g_warning ("Suggested monitor config has overlapping region, rejecting"); + g_warning ( + "Suggested monitor config has overlapping region, rejecting"); g_list_free (region); g_list_free_full (logical_monitor_configs, (GDestroyNotify) meta_logical_monitor_config_free); @@ -751,19 +759,23 @@ create_for_builtin_display_rotation (MetaMonitorConfigManager *config_manager, MetaMonitorConfig *monitor_config; MetaMonitorConfig *current_monitor_config; - if (!meta_monitor_manager_get_is_builtin_display_on (config_manager->monitor_manager)) + if (!meta_monitor_manager_get_is_builtin_display_on (config_manager-> + monitor_manager)) return NULL; if (!config_manager->current_config) return NULL; - if (g_list_length (config_manager->current_config->logical_monitor_configs) != 1) + if (g_list_length (config_manager->current_config->logical_monitor_configs) != + 1) return NULL; - current_logical_monitor_config = config_manager->current_config->logical_monitor_configs->data; + current_logical_monitor_config = + config_manager->current_config->logical_monitor_configs->data; if (rotate) - transform = (current_logical_monitor_config->transform + 1) % META_MONITOR_TRANSFORM_FLIPPED; + transform = (current_logical_monitor_config->transform + 1) % + META_MONITOR_TRANSFORM_FLIPPED; else { /* @@ -785,24 +797,33 @@ create_for_builtin_display_rotation (MetaMonitorConfigManager *config_manager, if (g_list_length (current_logical_monitor_config->monitor_configs) != 1) return NULL; - current_monitor_config = current_logical_monitor_config->monitor_configs->data; + current_monitor_config = + current_logical_monitor_config->monitor_configs->data; monitor_config = g_new0 (MetaMonitorConfig, 1); *monitor_config = (MetaMonitorConfig) { - .monitor_spec = meta_monitor_spec_clone (current_monitor_config->monitor_spec), - .mode_spec = g_memdup (current_monitor_config->mode_spec, sizeof (MetaMonitorModeSpec)), + .monitor_spec = meta_monitor_spec_clone ( + current_monitor_config->monitor_spec), + .mode_spec = + g_memdup (current_monitor_config->mode_spec, + sizeof (MetaMonitorModeSpec)), .enable_underscanning = current_monitor_config->enable_underscanning }; - logical_monitor_config = g_memdup (current_logical_monitor_config, sizeof (MetaLogicalMonitorConfig)); - logical_monitor_config->monitor_configs = g_list_append (NULL, monitor_config); + logical_monitor_config = + g_memdup (current_logical_monitor_config, + sizeof (MetaLogicalMonitorConfig)); + logical_monitor_config->monitor_configs = + g_list_append (NULL, monitor_config); logical_monitor_config->transform = transform; - if (meta_monitor_transform_is_rotated (current_logical_monitor_config->transform) != + if (meta_monitor_transform_is_rotated (current_logical_monitor_config-> + transform) != meta_monitor_transform_is_rotated (logical_monitor_config->transform)) { int temp = logical_monitor_config->layout.width; - logical_monitor_config->layout.width = logical_monitor_config->layout.height; + logical_monitor_config->layout.width = + logical_monitor_config->layout.height; logical_monitor_config->layout.height = temp; } @@ -815,16 +836,19 @@ create_for_builtin_display_rotation (MetaMonitorConfigManager *config_manager, } MetaMonitorsConfig * -meta_monitor_config_manager_create_for_orientation (MetaMonitorConfigManager *config_manager, - MetaMonitorTransform transform) +meta_monitor_config_manager_create_for_orientation ( + MetaMonitorConfigManager *config_manager, + MetaMonitorTransform transform) { return create_for_builtin_display_rotation (config_manager, FALSE, transform); } MetaMonitorsConfig * -meta_monitor_config_manager_create_for_rotate_monitor (MetaMonitorConfigManager *config_manager) +meta_monitor_config_manager_create_for_rotate_monitor ( + MetaMonitorConfigManager *config_manager) { - return create_for_builtin_display_rotation (config_manager, TRUE, META_MONITOR_TRANSFORM_NORMAL); + return create_for_builtin_display_rotation (config_manager, TRUE, + META_MONITOR_TRANSFORM_NORMAL); } static MetaMonitorsConfig * @@ -914,9 +938,11 @@ create_for_switch_config_all_mirror (MetaMonitorConfigManager *config_manager) if (!mode) continue; - scale = meta_monitor_manager_calculate_monitor_mode_scale (monitor_manager, monitor, mode); + scale = meta_monitor_manager_calculate_monitor_mode_scale ( + monitor_manager, monitor, mode); best_scale = MAX (best_scale, scale); - monitor_configs = g_list_prepend (monitor_configs, create_monitor_config (monitor, mode)); + monitor_configs = + g_list_prepend (monitor_configs, create_monitor_config (monitor, mode)); } logical_monitor_config = g_new0 (MetaLogicalMonitorConfig, 1); @@ -1013,8 +1039,9 @@ create_for_switch_config_builtin (MetaMonitorConfigManager *config_manager) } MetaMonitorsConfig * -meta_monitor_config_manager_create_for_switch_config (MetaMonitorConfigManager *config_manager, - MetaMonitorSwitchConfigType config_type) +meta_monitor_config_manager_create_for_switch_config ( + MetaMonitorConfigManager *config_manager, + MetaMonitorSwitchConfigType config_type) { MetaMonitorManager *monitor_manager = config_manager->monitor_manager; MetaMonitorsConfig *config; @@ -1049,8 +1076,9 @@ meta_monitor_config_manager_create_for_switch_config (MetaMonitorConfigManager } void -meta_monitor_config_manager_set_current (MetaMonitorConfigManager *config_manager, - MetaMonitorsConfig *config) +meta_monitor_config_manager_set_current ( + MetaMonitorConfigManager *config_manager, + MetaMonitorsConfig *config) { if (config_manager->current_config) { @@ -1065,7 +1093,8 @@ meta_monitor_config_manager_set_current (MetaMonitorConfigManager *config_manage } void -meta_monitor_config_manager_save_current (MetaMonitorConfigManager *config_manager) +meta_monitor_config_manager_save_current ( + MetaMonitorConfigManager *config_manager) { g_return_if_fail (config_manager->current_config); @@ -1074,27 +1103,32 @@ meta_monitor_config_manager_save_current (MetaMonitorConfigManager *config_manag } MetaMonitorsConfig * -meta_monitor_config_manager_get_current (MetaMonitorConfigManager *config_manager) +meta_monitor_config_manager_get_current ( + MetaMonitorConfigManager *config_manager) { return config_manager->current_config; } MetaMonitorsConfig * -meta_monitor_config_manager_pop_previous (MetaMonitorConfigManager *config_manager) +meta_monitor_config_manager_pop_previous ( + MetaMonitorConfigManager *config_manager) { return g_queue_pop_head (&config_manager->config_history); } MetaMonitorsConfig * -meta_monitor_config_manager_get_previous (MetaMonitorConfigManager *config_manager) +meta_monitor_config_manager_get_previous ( + MetaMonitorConfigManager *config_manager) { return g_queue_peek_head (&config_manager->config_history); } void -meta_monitor_config_manager_clear_history (MetaMonitorConfigManager *config_manager) +meta_monitor_config_manager_clear_history ( + MetaMonitorConfigManager *config_manager) { - g_queue_foreach (&config_manager->config_history, (GFunc) g_object_unref, NULL); + g_queue_foreach (&config_manager->config_history, (GFunc) g_object_unref, + NULL); g_queue_clear (&config_manager->config_history); } @@ -1133,7 +1167,8 @@ meta_monitor_config_free (MetaMonitorConfig *monitor_config) } void -meta_logical_monitor_config_free (MetaLogicalMonitorConfig *logical_monitor_config) +meta_logical_monitor_config_free ( + MetaLogicalMonitorConfig *logical_monitor_config) { g_list_free_full (logical_monitor_config->monitor_configs, (GDestroyNotify) meta_monitor_config_free); @@ -1244,17 +1279,18 @@ meta_monitors_config_get_switch_config (MetaMonitorsConfig *config) } void -meta_monitors_config_set_switch_config (MetaMonitorsConfig *config, - MetaMonitorSwitchConfigType switch_config) +meta_monitors_config_set_switch_config (MetaMonitorsConfig *config, + MetaMonitorSwitchConfigType switch_config) { config->switch_config = switch_config; } MetaMonitorsConfig * -meta_monitors_config_new_full (GList *logical_monitor_configs, - GList *disabled_monitor_specs, - MetaLogicalMonitorLayoutMode layout_mode, - MetaMonitorsConfigFlag flags) +meta_monitors_config_new_full ( + GList *logical_monitor_configs, + GList *disabled_monitor_specs, + MetaLogicalMonitorLayoutMode layout_mode, + MetaMonitorsConfigFlag flags) { MetaMonitorsConfig *config; @@ -1271,10 +1307,10 @@ meta_monitors_config_new_full (GList *logical_monitor_con } MetaMonitorsConfig * -meta_monitors_config_new (MetaMonitorManager *monitor_manager, - GList *logical_monitor_configs, - MetaLogicalMonitorLayoutMode layout_mode, - MetaMonitorsConfigFlag flags) +meta_monitors_config_new (MetaMonitorManager *monitor_manager, + GList *logical_monitor_configs, + MetaLogicalMonitorLayoutMode layout_mode, + MetaMonitorsConfigFlag flags) { GList *disabled_monitor_specs = NULL; GList *monitors; @@ -1400,10 +1436,11 @@ meta_verify_monitor_config (MetaMonitorConfig *monitor_config, } gboolean -meta_verify_logical_monitor_config (MetaLogicalMonitorConfig *logical_monitor_config, - MetaLogicalMonitorLayoutMode layout_mode, - MetaMonitorManager *monitor_manager, - GError **error) +meta_verify_logical_monitor_config ( + MetaLogicalMonitorConfig *logical_monitor_config, + MetaLogicalMonitorLayoutMode layout_mode, + MetaMonitorManager *monitor_manager, + GError **error) { GList *l; int expected_mode_width = 0; @@ -1494,8 +1531,9 @@ has_adjecent_neighbour (MetaMonitorsConfig *config, } gboolean -meta_logical_monitor_configs_have_monitor (GList *logical_monitor_configs, - MetaMonitorSpec *monitor_spec) +meta_logical_monitor_configs_have_monitor ( + GList *logical_monitor_configs, + MetaMonitorSpec *monitor_spec) { GList *l; @@ -1521,8 +1559,9 @@ static gboolean meta_monitors_config_is_monitor_enabled (MetaMonitorsConfig *config, MetaMonitorSpec *monitor_spec) { - return meta_logical_monitor_configs_have_monitor (config->logical_monitor_configs, - monitor_spec); + return meta_logical_monitor_configs_have_monitor ( + config->logical_monitor_configs, + monitor_spec); } gboolean diff --git a/src/backends/meta-monitor-config-migration.c b/src/backends/meta-monitor-config-migration.c index d619dc433..ece99abfa 100644 --- a/src/backends/meta-monitor-config-migration.c +++ b/src/backends/meta-monitor-config-migration.c @@ -24,7 +24,8 @@ */ /* - * Portions of this file are derived from gnome-desktop/libgnome-desktop/gnome-rr-config.c + * Portions of this file are derived from + *gnome-desktop/libgnome-desktop/gnome-rr-config.c * * Copyright 2007, 2008, Red Hat, Inc. * Copyright 2010 Giovanni Campagna @@ -44,10 +45,11 @@ #include "backends/meta-monitor-manager-private.h" #include "meta/boxes.h" -#define META_MONITORS_CONFIG_MIGRATION_ERROR (meta_monitors_config_migration_error_quark ()) +#define META_MONITORS_CONFIG_MIGRATION_ERROR ( \ + meta_monitors_config_migration_error_quark ()) static GQuark meta_monitors_config_migration_error_quark (void); -G_DEFINE_QUARK (meta-monitors-config-migration-error-quark, +G_DEFINE_QUARK (meta - monitors - config - migration - error - quark, meta_monitors_config_migration_error) enum _MetaConfigMigrationError @@ -198,125 +200,125 @@ handle_start_element (GMarkupParseContext *context, switch (parser->state) { case STATE_INITIAL: - { - char *version; + { + char *version; - if (strcmp (element_name, "monitors") != 0) - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, - "Invalid document element %s", element_name); - return; - } - - if (!g_markup_collect_attributes (element_name, - attribute_names, - attribute_values, - error, - G_MARKUP_COLLECT_STRING, - "version", &version, - G_MARKUP_COLLECT_INVALID)) + if (strcmp (element_name, "monitors") != 0) + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, + "Invalid document element %s", element_name); return; + } - if (strcmp (version, "1") != 0) - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, - "Invalid or unsupported version %s", version); - return; - } - - parser->state = STATE_MONITORS; + if (!g_markup_collect_attributes (element_name, + attribute_names, + attribute_values, + error, + G_MARKUP_COLLECT_STRING, + "version", &version, + G_MARKUP_COLLECT_INVALID)) return; - } + + if (strcmp (version, "1") != 0) + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, + "Invalid or unsupported version %s", version); + return; + } + + parser->state = STATE_MONITORS; + return; + } case STATE_MONITORS: - { - if (strcmp (element_name, "configuration") != 0) - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, - "Invalid toplevel element %s", element_name); - return; - } + { + if (strcmp (element_name, "configuration") != 0) + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, + "Invalid toplevel element %s", element_name); + return; + } - parser->key_array = g_array_new (FALSE, FALSE, - sizeof (MetaOutputKey)); - parser->output_array = g_array_new (FALSE, FALSE, - sizeof (MetaOutputConfig)); - parser->state = STATE_CONFIGURATION; - return; - } + parser->key_array = g_array_new (FALSE, FALSE, + sizeof (MetaOutputKey)); + parser->output_array = g_array_new (FALSE, FALSE, + sizeof (MetaOutputConfig)); + parser->state = STATE_CONFIGURATION; + return; + } case STATE_CONFIGURATION: - { - if (strcmp (element_name, "clone") == 0 && - parser->unknown_count == 0) - { - parser->state = STATE_CLONE; - } - else if (strcmp (element_name, "output") == 0 && - parser->unknown_count == 0) - { - char *name; - - if (!g_markup_collect_attributes (element_name, - attribute_names, - attribute_values, - error, - G_MARKUP_COLLECT_STRING, - "name", &name, - G_MARKUP_COLLECT_INVALID)) - return; - - memset (&parser->key, 0, sizeof (MetaOutputKey)); - memset (&parser->output, 0, sizeof (MetaOutputConfig)); - - parser->key.connector = g_strdup (name); - parser->state = STATE_OUTPUT; - } - else - { - parser->unknown_count++; - } + { + if (strcmp (element_name, "clone") == 0 && + parser->unknown_count == 0) + { + parser->state = STATE_CLONE; + } + else if (strcmp (element_name, "output") == 0 && + parser->unknown_count == 0) + { + char *name; + + if (!g_markup_collect_attributes (element_name, + attribute_names, + attribute_values, + error, + G_MARKUP_COLLECT_STRING, + "name", &name, + G_MARKUP_COLLECT_INVALID)) + return; - return; - } + memset (&parser->key, 0, sizeof (MetaOutputKey)); + memset (&parser->output, 0, sizeof (MetaOutputConfig)); + + parser->key.connector = g_strdup (name); + parser->state = STATE_OUTPUT; + } + else + { + parser->unknown_count++; + } + + return; + } case STATE_OUTPUT: - { - if ((strcmp (element_name, "vendor") == 0 || - strcmp (element_name, "product") == 0 || - strcmp (element_name, "serial") == 0 || - strcmp (element_name, "width") == 0 || - strcmp (element_name, "height") == 0 || - strcmp (element_name, "rate") == 0 || - strcmp (element_name, "x") == 0 || - strcmp (element_name, "y") == 0 || - strcmp (element_name, "rotation") == 0 || - strcmp (element_name, "reflect_x") == 0 || - strcmp (element_name, "reflect_y") == 0 || - strcmp (element_name, "primary") == 0 || - strcmp (element_name, "presentation") == 0 || - strcmp (element_name, "underscanning") == 0) && - parser->unknown_count == 0) - { - parser->state = STATE_OUTPUT_FIELD; - - parser->output_field = g_strdup (element_name); - } - else - { - parser->unknown_count++; - } + { + if ((strcmp (element_name, "vendor") == 0 || + strcmp (element_name, "product") == 0 || + strcmp (element_name, "serial") == 0 || + strcmp (element_name, "width") == 0 || + strcmp (element_name, "height") == 0 || + strcmp (element_name, "rate") == 0 || + strcmp (element_name, "x") == 0 || + strcmp (element_name, "y") == 0 || + strcmp (element_name, "rotation") == 0 || + strcmp (element_name, "reflect_x") == 0 || + strcmp (element_name, "reflect_y") == 0 || + strcmp (element_name, "primary") == 0 || + strcmp (element_name, "presentation") == 0 || + strcmp (element_name, "underscanning") == 0) && + parser->unknown_count == 0) + { + parser->state = STATE_OUTPUT_FIELD; - return; - } + parser->output_field = g_strdup (element_name); + } + else + { + parser->unknown_count++; + } + + return; + } case STATE_CLONE: case STATE_OUTPUT_FIELD: - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, - "Unexpected element %s", element_name); - return; - } + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, + "Unexpected element %s", element_name); + return; + } default: g_assert_not_reached (); @@ -334,92 +336,92 @@ handle_end_element (GMarkupParseContext *context, switch (parser->state) { case STATE_MONITORS: - { - parser->state = STATE_INITIAL; - return; - } + { + parser->state = STATE_INITIAL; + return; + } case STATE_CONFIGURATION: - { - if (strcmp (element_name, "configuration") == 0 && - parser->unknown_count == 0) - { - MetaLegacyMonitorsConfig *config = legacy_config_new (); + { + if (strcmp (element_name, "configuration") == 0 && + parser->unknown_count == 0) + { + MetaLegacyMonitorsConfig *config = legacy_config_new (); - g_assert (parser->key_array->len == parser->output_array->len); + g_assert (parser->key_array->len == parser->output_array->len); - config->n_outputs = parser->key_array->len; - config->keys = (void*)g_array_free (parser->key_array, FALSE); - config->outputs = (void*)g_array_free (parser->output_array, FALSE); + config->n_outputs = parser->key_array->len; + config->keys = (void *) g_array_free (parser->key_array, FALSE); + config->outputs = (void *) g_array_free (parser->output_array, FALSE); - g_hash_table_replace (parser->configs, config, config); + g_hash_table_replace (parser->configs, config, config); - parser->key_array = NULL; - parser->output_array = NULL; - parser->state = STATE_MONITORS; - } - else - { - parser->unknown_count--; + parser->key_array = NULL; + parser->output_array = NULL; + parser->state = STATE_MONITORS; + } + else + { + parser->unknown_count--; - g_assert (parser->unknown_count >= 0); - } + g_assert (parser->unknown_count >= 0); + } - return; - } + return; + } case STATE_OUTPUT: - { - if (strcmp (element_name, "output") == 0 && parser->unknown_count == 0) - { - if (parser->key.vendor == NULL || - parser->key.product == NULL || - parser->key.serial == NULL) - { - /* Disconnected output, ignore */ - free_output_key (&parser->key); - } - else - { - if (parser->output.rect.width == 0 || - parser->output.rect.height == 0) - parser->output.enabled = FALSE; - else - parser->output.enabled = TRUE; - - g_array_append_val (parser->key_array, parser->key); - g_array_append_val (parser->output_array, parser->output); - } - - memset (&parser->key, 0, sizeof (MetaOutputKey)); - memset (&parser->output, 0, sizeof (MetaOutputConfig)); - - parser->state = STATE_CONFIGURATION; - } - else - { - parser->unknown_count--; - - g_assert (parser->unknown_count >= 0); - } + { + if (strcmp (element_name, "output") == 0 && parser->unknown_count == 0) + { + if (parser->key.vendor == NULL || + parser->key.product == NULL || + parser->key.serial == NULL) + { + /* Disconnected output, ignore */ + free_output_key (&parser->key); + } + else + { + if (parser->output.rect.width == 0 || + parser->output.rect.height == 0) + parser->output.enabled = FALSE; + else + parser->output.enabled = TRUE; - return; - } + g_array_append_val (parser->key_array, parser->key); + g_array_append_val (parser->output_array, parser->output); + } + + memset (&parser->key, 0, sizeof (MetaOutputKey)); + memset (&parser->output, 0, sizeof (MetaOutputConfig)); + + parser->state = STATE_CONFIGURATION; + } + else + { + parser->unknown_count--; + + g_assert (parser->unknown_count >= 0); + } + + return; + } case STATE_CLONE: - { - parser->state = STATE_CONFIGURATION; - return; - } + { + parser->state = STATE_CONFIGURATION; + return; + } case STATE_OUTPUT_FIELD: - { - g_free (parser->output_field); - parser->output_field = NULL; + { + g_free (parser->output_field); + parser->output_field = NULL; - parser->state = STATE_OUTPUT; - return; - } + parser->state = STATE_OUTPUT; + return; + } case STATE_INITIAL: default: @@ -451,10 +453,10 @@ read_int (const char *text, } static void -read_float (const char *text, - gsize text_len, - gfloat *field, - GError **error) +read_float (const char *text, + gsize text_len, + gfloat *field, + GError **error) { char buf[64]; gfloat v; @@ -474,9 +476,9 @@ read_float (const char *text, } static gboolean -read_bool (const char *text, - gsize text_len, - GError **error) +read_bool (const char *text, + gsize text_len, + GError **error) { if (strncmp (text, "no", text_len) == 0) return FALSE; @@ -484,7 +486,7 @@ read_bool (const char *text, return TRUE; else g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, - "Invalid boolean value %.*s", (int)text_len, text); + "Invalid boolean value %.*s", (int) text_len, text); return FALSE; } @@ -514,101 +516,101 @@ handle_text (GMarkupParseContext *context, switch (parser->state) { case STATE_MONITORS: - { - if (!is_all_whitespace (text, text_len)) - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, - "Unexpected content at this point"); - return; - } + { + if (!is_all_whitespace (text, text_len)) + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, + "Unexpected content at this point"); + return; + } case STATE_CONFIGURATION: - { - if (parser->unknown_count == 0) - { - if (!is_all_whitespace (text, text_len)) - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, - "Unexpected content at this point"); - } - else - { - /* Handling unknown element, ignore */ - } + { + if (parser->unknown_count == 0) + { + if (!is_all_whitespace (text, text_len)) + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, + "Unexpected content at this point"); + } + else + { + /* Handling unknown element, ignore */ + } - return; - } + return; + } case STATE_OUTPUT: - { - if (parser->unknown_count == 0) - { - if (!is_all_whitespace (text, text_len)) - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, - "Unexpected content at this point"); - } - else - { - /* Handling unknown element, ignore */ - } - return; - } + { + if (parser->unknown_count == 0) + { + if (!is_all_whitespace (text, text_len)) + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, + "Unexpected content at this point"); + } + else + { + /* Handling unknown element, ignore */ + } + return; + } case STATE_CLONE: - { - /* Ignore the clone flag */ - return; - } + { + /* Ignore the clone flag */ + return; + } case STATE_OUTPUT_FIELD: - { - if (strcmp (parser->output_field, "vendor") == 0) - parser->key.vendor = g_strndup (text, text_len); - else if (strcmp (parser->output_field, "product") == 0) - parser->key.product = g_strndup (text, text_len); - else if (strcmp (parser->output_field, "serial") == 0) - parser->key.serial = g_strndup (text, text_len); - else if (strcmp (parser->output_field, "width") == 0) - read_int (text, text_len, &parser->output.rect.width, error); - else if (strcmp (parser->output_field, "height") == 0) - read_int (text, text_len, &parser->output.rect.height, error); - else if (strcmp (parser->output_field, "rate") == 0) - read_float (text, text_len, &parser->output.refresh_rate, error); - else if (strcmp (parser->output_field, "x") == 0) - read_int (text, text_len, &parser->output.rect.x, error); - else if (strcmp (parser->output_field, "y") == 0) - read_int (text, text_len, &parser->output.rect.y, error); - else if (strcmp (parser->output_field, "rotation") == 0) - { - if (strncmp (text, "normal", text_len) == 0) - parser->output.transform = META_MONITOR_TRANSFORM_NORMAL; - else if (strncmp (text, "left", text_len) == 0) - parser->output.transform = META_MONITOR_TRANSFORM_90; - else if (strncmp (text, "upside_down", text_len) == 0) - parser->output.transform = META_MONITOR_TRANSFORM_180; - else if (strncmp (text, "right", text_len) == 0) - 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) ? - META_MONITOR_TRANSFORM_FLIPPED : 0; - else if (strcmp (parser->output_field, "reflect_y") == 0) - { - if (read_bool (text, text_len, error)) - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, - "Y reflection is not supported"); - } - else if (strcmp (parser->output_field, "primary") == 0) - parser->output.is_primary = read_bool (text, text_len, error); - else if (strcmp (parser->output_field, "presentation") == 0) - parser->output.is_presentation = read_bool (text, text_len, error); - else if (strcmp (parser->output_field, "underscanning") == 0) - parser->output.is_underscanning = read_bool (text, text_len, error); - else - g_assert_not_reached (); - return; - } + { + if (strcmp (parser->output_field, "vendor") == 0) + parser->key.vendor = g_strndup (text, text_len); + else if (strcmp (parser->output_field, "product") == 0) + parser->key.product = g_strndup (text, text_len); + else if (strcmp (parser->output_field, "serial") == 0) + parser->key.serial = g_strndup (text, text_len); + else if (strcmp (parser->output_field, "width") == 0) + read_int (text, text_len, &parser->output.rect.width, error); + else if (strcmp (parser->output_field, "height") == 0) + read_int (text, text_len, &parser->output.rect.height, error); + else if (strcmp (parser->output_field, "rate") == 0) + read_float (text, text_len, &parser->output.refresh_rate, error); + else if (strcmp (parser->output_field, "x") == 0) + read_int (text, text_len, &parser->output.rect.x, error); + else if (strcmp (parser->output_field, "y") == 0) + read_int (text, text_len, &parser->output.rect.y, error); + else if (strcmp (parser->output_field, "rotation") == 0) + { + if (strncmp (text, "normal", text_len) == 0) + parser->output.transform = META_MONITOR_TRANSFORM_NORMAL; + else if (strncmp (text, "left", text_len) == 0) + parser->output.transform = META_MONITOR_TRANSFORM_90; + else if (strncmp (text, "upside_down", text_len) == 0) + parser->output.transform = META_MONITOR_TRANSFORM_180; + else if (strncmp (text, "right", text_len) == 0) + 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) ? + META_MONITOR_TRANSFORM_FLIPPED : 0; + else if (strcmp (parser->output_field, "reflect_y") == 0) + { + if (read_bool (text, text_len, error)) + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, + "Y reflection is not supported"); + } + else if (strcmp (parser->output_field, "primary") == 0) + parser->output.is_primary = read_bool (text, text_len, error); + else if (strcmp (parser->output_field, "presentation") == 0) + parser->output.is_presentation = read_bool (text, text_len, error); + else if (strcmp (parser->output_field, "underscanning") == 0) + parser->output.is_underscanning = read_bool (text, text_len, error); + else + g_assert_not_reached (); + return; + } case STATE_INITIAL: default: @@ -616,7 +618,8 @@ handle_text (GMarkupParseContext *context, } } -static const GMarkupParser config_parser = { +static const GMarkupParser config_parser = +{ .start_element = handle_start_element, .end_element = handle_end_element, .text = handle_text, diff --git a/src/backends/meta-monitor-config-store.c b/src/backends/meta-monitor-config-store.c index ed0ce34f0..c21ccaa57 100644 --- a/src/backends/meta-monitor-config-store.c +++ b/src/backends/meta-monitor-config-store.c @@ -32,7 +32,7 @@ #define MONITORS_CONFIG_XML_FORMAT_VERSION 2 #define QUOTE1(a) #a -#define QUOTE(a) QUOTE1(a) +#define QUOTE(a) QUOTE1 (a) /* * Example configuration: @@ -130,7 +130,7 @@ enum META_MONITOR_CONFIG_STORE_ERROR_NEEDS_MIGRATION }; -G_DEFINE_QUARK (meta-monitor-config-store-error-quark, +G_DEFINE_QUARK (meta - monitor - config - store - error - quark, meta_monitor_config_store_error) typedef enum @@ -185,316 +185,320 @@ G_DEFINE_TYPE (MetaMonitorConfigStore, meta_monitor_config_store, G_TYPE_OBJECT) static void -handle_start_element (GMarkupParseContext *context, - const char *element_name, - const char **attribute_names, - const char **attribute_values, - gpointer user_data, - GError **error) +handle_start_element (GMarkupParseContext *context, + const char *element_name, + const char **attribute_names, + const char **attribute_values, + gpointer user_data, + GError **error) { ConfigParser *parser = user_data; switch (parser->state) { case STATE_INITIAL: - { - char *version; + { + char *version; - if (!g_str_equal (element_name, "monitors")) - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, - "Invalid document element '%s'", element_name); - return; - } - - if (!g_markup_collect_attributes (element_name, attribute_names, attribute_values, - error, - G_MARKUP_COLLECT_STRING, "version", &version, - G_MARKUP_COLLECT_INVALID)) - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, - "Missing config file format version"); - } - - if (g_str_equal (version, "1")) - { - g_set_error_literal (error, - META_MONITOR_CONFIG_STORE_ERROR, - META_MONITOR_CONFIG_STORE_ERROR_NEEDS_MIGRATION, - "monitors.xml has the old format"); - return; - } + if (!g_str_equal (element_name, "monitors")) + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, + "Invalid document element '%s'", element_name); + return; + } - if (!g_str_equal (version, QUOTE (MONITORS_CONFIG_XML_FORMAT_VERSION))) - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, - "Invalid or unsupported version '%s'", version); - return; - } + if (!g_markup_collect_attributes (element_name, attribute_names, + attribute_values, + error, + G_MARKUP_COLLECT_STRING, "version", + &version, + G_MARKUP_COLLECT_INVALID)) + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, + "Missing config file format version"); + } - parser->state = STATE_MONITORS; - return; - } + if (g_str_equal (version, "1")) + { + g_set_error_literal (error, + META_MONITOR_CONFIG_STORE_ERROR, + META_MONITOR_CONFIG_STORE_ERROR_NEEDS_MIGRATION, + "monitors.xml has the old format"); + return; + } + + if (!g_str_equal (version, QUOTE (MONITORS_CONFIG_XML_FORMAT_VERSION))) + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, + "Invalid or unsupported version '%s'", version); + return; + } + + parser->state = STATE_MONITORS; + return; + } case STATE_MONITORS: - { - if (!g_str_equal (element_name, "configuration")) - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, - "Invalid toplevel element '%s'", element_name); - return; - } + { + if (!g_str_equal (element_name, "configuration")) + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, + "Invalid toplevel element '%s'", element_name); + return; + } - parser->state = STATE_CONFIGURATION; - parser->current_was_migrated = FALSE; + parser->state = STATE_CONFIGURATION; + parser->current_was_migrated = FALSE; - return; - } + return; + } case STATE_CONFIGURATION: - { - if (g_str_equal (element_name, "logicalmonitor")) - { - parser->current_logical_monitor_config = - g_new0 (MetaLogicalMonitorConfig, 1); - - parser->state = STATE_LOGICAL_MONITOR; - } - else if (g_str_equal (element_name, "migrated")) - { - parser->current_was_migrated = TRUE; - - parser->state = STATE_MIGRATED; - } - else if (g_str_equal (element_name, "disabled")) - { - parser->state = STATE_DISABLED; - } - else - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, - "Invalid configuration element '%s'", element_name); - return; - } + { + if (g_str_equal (element_name, "logicalmonitor")) + { + parser->current_logical_monitor_config = + g_new0 (MetaLogicalMonitorConfig, 1); - return; - } + parser->state = STATE_LOGICAL_MONITOR; + } + else if (g_str_equal (element_name, "migrated")) + { + parser->current_was_migrated = TRUE; + + parser->state = STATE_MIGRATED; + } + else if (g_str_equal (element_name, "disabled")) + { + parser->state = STATE_DISABLED; + } + else + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, + "Invalid configuration element '%s'", element_name); + return; + } + + return; + } case STATE_MIGRATED: - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, - "Unexpected element '%s'", element_name); - return; - } + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, + "Unexpected element '%s'", element_name); + return; + } case STATE_LOGICAL_MONITOR: - { - if (g_str_equal (element_name, "x")) - { - parser->state = STATE_LOGICAL_MONITOR_X; - } - else if (g_str_equal (element_name, "y")) - { - parser->state = STATE_LOGICAL_MONITOR_Y; - } - else if (g_str_equal (element_name, "scale")) - { - parser->state = STATE_LOGICAL_MONITOR_SCALE; - } - else if (g_str_equal (element_name, "primary")) - { - parser->state = STATE_LOGICAL_MONITOR_PRIMARY; - } - else if (g_str_equal (element_name, "presentation")) - { - parser->state = STATE_LOGICAL_MONITOR_PRESENTATION; - } - else if (g_str_equal (element_name, "transform")) - { - parser->state = STATE_TRANSFORM; - } - else if (g_str_equal (element_name, "monitor")) - { - parser->current_monitor_config = g_new0 (MetaMonitorConfig, 1);; - - parser->state = STATE_MONITOR; - } - else - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, - "Invalid monitor logicalmonitor element '%s'", element_name); - return; - } + { + if (g_str_equal (element_name, "x")) + { + parser->state = STATE_LOGICAL_MONITOR_X; + } + else if (g_str_equal (element_name, "y")) + { + parser->state = STATE_LOGICAL_MONITOR_Y; + } + else if (g_str_equal (element_name, "scale")) + { + parser->state = STATE_LOGICAL_MONITOR_SCALE; + } + else if (g_str_equal (element_name, "primary")) + { + parser->state = STATE_LOGICAL_MONITOR_PRIMARY; + } + else if (g_str_equal (element_name, "presentation")) + { + parser->state = STATE_LOGICAL_MONITOR_PRESENTATION; + } + else if (g_str_equal (element_name, "transform")) + { + parser->state = STATE_TRANSFORM; + } + else if (g_str_equal (element_name, "monitor")) + { + parser->current_monitor_config = g_new0 (MetaMonitorConfig, 1); - return; - } + parser->state = STATE_MONITOR; + } + else + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, + "Invalid monitor logicalmonitor element '%s'", + element_name); + return; + } + + return; + } case STATE_LOGICAL_MONITOR_X: case STATE_LOGICAL_MONITOR_Y: case STATE_LOGICAL_MONITOR_SCALE: case STATE_LOGICAL_MONITOR_PRIMARY: case STATE_LOGICAL_MONITOR_PRESENTATION: - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, - "Invalid logical monitor element '%s'", element_name); - return; - } + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, + "Invalid logical monitor element '%s'", element_name); + return; + } case STATE_TRANSFORM: - { - if (g_str_equal (element_name, "rotation")) - { - parser->state = STATE_TRANSFORM_ROTATION; - } - else if (g_str_equal (element_name, "flipped")) - { - parser->state = STATE_TRANSFORM_FLIPPED; - } + { + if (g_str_equal (element_name, "rotation")) + { + parser->state = STATE_TRANSFORM_ROTATION; + } + else if (g_str_equal (element_name, "flipped")) + { + parser->state = STATE_TRANSFORM_FLIPPED; + } - return; - } + return; + } case STATE_TRANSFORM_ROTATION: case STATE_TRANSFORM_FLIPPED: - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, - "Invalid transform element '%s'", element_name); - return; - } + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, + "Invalid transform element '%s'", element_name); + return; + } case STATE_MONITOR: - { - if (g_str_equal (element_name, "monitorspec")) - { - parser->current_monitor_spec = g_new0 (MetaMonitorSpec, 1); - parser->monitor_spec_parent_state = STATE_MONITOR; - parser->state = STATE_MONITOR_SPEC; - } - else if (g_str_equal (element_name, "mode")) - { - parser->current_monitor_mode_spec = g_new0 (MetaMonitorModeSpec, 1); - - parser->state = STATE_MONITOR_MODE; - } - else if (g_str_equal (element_name, "underscanning")) - { - parser->state = STATE_MONITOR_UNDERSCANNING; - } - else - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, - "Invalid monitor element '%s'", element_name); - return; - } + { + if (g_str_equal (element_name, "monitorspec")) + { + parser->current_monitor_spec = g_new0 (MetaMonitorSpec, 1); + parser->monitor_spec_parent_state = STATE_MONITOR; + parser->state = STATE_MONITOR_SPEC; + } + else if (g_str_equal (element_name, "mode")) + { + parser->current_monitor_mode_spec = g_new0 (MetaMonitorModeSpec, 1); - return; - } + parser->state = STATE_MONITOR_MODE; + } + else if (g_str_equal (element_name, "underscanning")) + { + parser->state = STATE_MONITOR_UNDERSCANNING; + } + else + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, + "Invalid monitor element '%s'", element_name); + return; + } + + return; + } case STATE_MONITOR_SPEC: - { - if (g_str_equal (element_name, "connector")) - { - parser->state = STATE_MONITOR_SPEC_CONNECTOR; - } - else if (g_str_equal (element_name, "vendor")) - { - parser->state = STATE_MONITOR_SPEC_VENDOR; - } - else if (g_str_equal (element_name, "product")) - { - parser->state = STATE_MONITOR_SPEC_PRODUCT; - } - else if (g_str_equal (element_name, "serial")) - { - parser->state = STATE_MONITOR_SPEC_SERIAL; - } - else - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, - "Invalid monitor spec element '%s'", element_name); - return; - } + { + if (g_str_equal (element_name, "connector")) + { + parser->state = STATE_MONITOR_SPEC_CONNECTOR; + } + else if (g_str_equal (element_name, "vendor")) + { + parser->state = STATE_MONITOR_SPEC_VENDOR; + } + else if (g_str_equal (element_name, "product")) + { + parser->state = STATE_MONITOR_SPEC_PRODUCT; + } + else if (g_str_equal (element_name, "serial")) + { + parser->state = STATE_MONITOR_SPEC_SERIAL; + } + else + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, + "Invalid monitor spec element '%s'", element_name); + return; + } - return; - } + return; + } case STATE_MONITOR_SPEC_CONNECTOR: case STATE_MONITOR_SPEC_VENDOR: case STATE_MONITOR_SPEC_PRODUCT: case STATE_MONITOR_SPEC_SERIAL: - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, - "Invalid monitor spec element '%s'", element_name); - return; - } + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, + "Invalid monitor spec element '%s'", element_name); + return; + } case STATE_MONITOR_MODE: - { - if (g_str_equal (element_name, "width")) - { - parser->state = STATE_MONITOR_MODE_WIDTH; - } - else if (g_str_equal (element_name, "height")) - { - parser->state = STATE_MONITOR_MODE_HEIGHT; - } - else if (g_str_equal (element_name, "rate")) - { - parser->state = STATE_MONITOR_MODE_RATE; - } - else if (g_str_equal (element_name, "flag")) - { - parser->state = STATE_MONITOR_MODE_FLAG; - } - else - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, - "Invalid mode element '%s'", element_name); - return; - } + { + if (g_str_equal (element_name, "width")) + { + parser->state = STATE_MONITOR_MODE_WIDTH; + } + else if (g_str_equal (element_name, "height")) + { + parser->state = STATE_MONITOR_MODE_HEIGHT; + } + else if (g_str_equal (element_name, "rate")) + { + parser->state = STATE_MONITOR_MODE_RATE; + } + else if (g_str_equal (element_name, "flag")) + { + parser->state = STATE_MONITOR_MODE_FLAG; + } + else + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, + "Invalid mode element '%s'", element_name); + return; + } - return; - } + return; + } case STATE_MONITOR_MODE_WIDTH: case STATE_MONITOR_MODE_HEIGHT: case STATE_MONITOR_MODE_RATE: case STATE_MONITOR_MODE_FLAG: - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, - "Invalid mode sub element '%s'", element_name); - return; - } + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, + "Invalid mode sub element '%s'", element_name); + return; + } case STATE_MONITOR_UNDERSCANNING: - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, - "Invalid element '%s' under underscanning", element_name); - return; - } + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, + "Invalid element '%s' under underscanning", element_name); + return; + } case STATE_DISABLED: - { - if (!g_str_equal (element_name, "monitorspec")) - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, - "Invalid element '%s' under disabled", element_name); - return; - } + { + if (!g_str_equal (element_name, "monitorspec")) + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, + "Invalid element '%s' under disabled", element_name); + return; + } - parser->current_monitor_spec = g_new0 (MetaMonitorSpec, 1); - parser->monitor_spec_parent_state = STATE_DISABLED; - parser->state = STATE_MONITOR_SPEC; + parser->current_monitor_spec = g_new0 (MetaMonitorSpec, 1); + parser->monitor_spec_parent_state = STATE_DISABLED; + parser->state = STATE_MONITOR_SPEC; - return; - } + return; + } } } static gboolean -derive_logical_monitor_layout (MetaLogicalMonitorConfig *logical_monitor_config, - MetaLogicalMonitorLayoutMode layout_mode, - GError **error) +derive_logical_monitor_layout ( + MetaLogicalMonitorConfig *logical_monitor_config, + MetaLogicalMonitorLayoutMode layout_mode, + GError **error) { MetaMonitorConfig *monitor_config; int mode_width, mode_height; @@ -551,22 +555,22 @@ finish_monitor_spec (ConfigParser *parser) switch (parser->monitor_spec_parent_state) { case STATE_MONITOR: - { - parser->current_monitor_config->monitor_spec = - parser->current_monitor_spec; - parser->current_monitor_spec = NULL; + { + parser->current_monitor_config->monitor_spec = + parser->current_monitor_spec; + parser->current_monitor_spec = NULL; - return; - } + return; + } case STATE_DISABLED: - { - parser->current_disabled_monitor_specs = - g_list_prepend (parser->current_disabled_monitor_specs, - parser->current_monitor_spec); - parser->current_monitor_spec = NULL; + { + parser->current_disabled_monitor_specs = + g_list_prepend (parser->current_disabled_monitor_specs, + parser->current_monitor_spec); + parser->current_monitor_spec = NULL; - return; - } + return; + } default: g_assert_not_reached (); @@ -574,10 +578,10 @@ finish_monitor_spec (ConfigParser *parser) } static void -handle_end_element (GMarkupParseContext *context, - const char *element_name, - gpointer user_data, - GError **error) +handle_end_element (GMarkupParseContext *context, + const char *element_name, + gpointer user_data, + GError **error) { ConfigParser *parser = user_data; @@ -588,227 +592,227 @@ handle_end_element (GMarkupParseContext *context, case STATE_LOGICAL_MONITOR_SCALE: case STATE_LOGICAL_MONITOR_PRIMARY: case STATE_LOGICAL_MONITOR_PRESENTATION: - { - parser->state = STATE_LOGICAL_MONITOR; - return; - } + { + parser->state = STATE_LOGICAL_MONITOR; + return; + } case STATE_TRANSFORM: - { - g_assert (g_str_equal (element_name, "transform")); + { + g_assert (g_str_equal (element_name, "transform")); - parser->current_logical_monitor_config->transform = - parser->current_transform; - if (parser->current_transform_flipped) - { - parser->current_logical_monitor_config->transform += - META_MONITOR_TRANSFORM_FLIPPED; - } + parser->current_logical_monitor_config->transform = + parser->current_transform; + if (parser->current_transform_flipped) + { + parser->current_logical_monitor_config->transform += + META_MONITOR_TRANSFORM_FLIPPED; + } - parser->current_transform = META_MONITOR_TRANSFORM_NORMAL; - parser->current_transform_flipped = FALSE; + parser->current_transform = META_MONITOR_TRANSFORM_NORMAL; + parser->current_transform_flipped = FALSE; - parser->state = STATE_LOGICAL_MONITOR; - return; - } + parser->state = STATE_LOGICAL_MONITOR; + return; + } case STATE_TRANSFORM_ROTATION: case STATE_TRANSFORM_FLIPPED: - { - parser->state = STATE_TRANSFORM; - return; - } + { + parser->state = STATE_TRANSFORM; + return; + } case STATE_MONITOR_SPEC_CONNECTOR: case STATE_MONITOR_SPEC_VENDOR: case STATE_MONITOR_SPEC_PRODUCT: case STATE_MONITOR_SPEC_SERIAL: - { - parser->state = STATE_MONITOR_SPEC; - return; - } + { + parser->state = STATE_MONITOR_SPEC; + return; + } case STATE_MONITOR_SPEC: - { - g_assert (g_str_equal (element_name, "monitorspec")); + { + g_assert (g_str_equal (element_name, "monitorspec")); - if (!meta_verify_monitor_spec (parser->current_monitor_spec, error)) - return; + if (!meta_verify_monitor_spec (parser->current_monitor_spec, error)) + return; - finish_monitor_spec (parser); + finish_monitor_spec (parser); - parser->state = parser->monitor_spec_parent_state; - return; - } + parser->state = parser->monitor_spec_parent_state; + return; + } case STATE_MONITOR_MODE_WIDTH: case STATE_MONITOR_MODE_HEIGHT: case STATE_MONITOR_MODE_RATE: case STATE_MONITOR_MODE_FLAG: - { - parser->state = STATE_MONITOR_MODE; - return; - } + { + parser->state = STATE_MONITOR_MODE; + return; + } case STATE_MONITOR_MODE: - { - g_assert (g_str_equal (element_name, "mode")); + { + g_assert (g_str_equal (element_name, "mode")); - if (!meta_verify_monitor_mode_spec (parser->current_monitor_mode_spec, - error)) - return; + if (!meta_verify_monitor_mode_spec (parser->current_monitor_mode_spec, + error)) + return; - parser->current_monitor_config->mode_spec = - parser->current_monitor_mode_spec; - parser->current_monitor_mode_spec = NULL; + parser->current_monitor_config->mode_spec = + parser->current_monitor_mode_spec; + parser->current_monitor_mode_spec = NULL; - parser->state = STATE_MONITOR; - return; - } + parser->state = STATE_MONITOR; + return; + } case STATE_MONITOR_UNDERSCANNING: - { - g_assert (g_str_equal (element_name, "underscanning")); + { + g_assert (g_str_equal (element_name, "underscanning")); - parser->state = STATE_MONITOR; - return; - } + parser->state = STATE_MONITOR; + return; + } case STATE_MONITOR: - { - MetaLogicalMonitorConfig *logical_monitor_config; + { + MetaLogicalMonitorConfig *logical_monitor_config; - g_assert (g_str_equal (element_name, "monitor")); + g_assert (g_str_equal (element_name, "monitor")); - if (!meta_verify_monitor_config (parser->current_monitor_config, error)) - return; + if (!meta_verify_monitor_config (parser->current_monitor_config, error)) + return; - logical_monitor_config = parser->current_logical_monitor_config; + logical_monitor_config = parser->current_logical_monitor_config; - logical_monitor_config->monitor_configs = - g_list_append (logical_monitor_config->monitor_configs, - parser->current_monitor_config); - parser->current_monitor_config = NULL; + logical_monitor_config->monitor_configs = + g_list_append (logical_monitor_config->monitor_configs, + parser->current_monitor_config); + parser->current_monitor_config = NULL; - parser->state = STATE_LOGICAL_MONITOR; - return; - } + parser->state = STATE_LOGICAL_MONITOR; + return; + } case STATE_LOGICAL_MONITOR: - { - MetaLogicalMonitorConfig *logical_monitor_config = - parser->current_logical_monitor_config; + { + MetaLogicalMonitorConfig *logical_monitor_config = + parser->current_logical_monitor_config; - g_assert (g_str_equal (element_name, "logicalmonitor")); + g_assert (g_str_equal (element_name, "logicalmonitor")); - if (parser->current_was_migrated) - logical_monitor_config->scale = -1; - else if (logical_monitor_config->scale == 0) - logical_monitor_config->scale = 1; + if (parser->current_was_migrated) + logical_monitor_config->scale = -1; + else if (logical_monitor_config->scale == 0) + logical_monitor_config->scale = 1; - parser->current_logical_monitor_configs = - g_list_append (parser->current_logical_monitor_configs, - logical_monitor_config); - parser->current_logical_monitor_config = NULL; + parser->current_logical_monitor_configs = + g_list_append (parser->current_logical_monitor_configs, + logical_monitor_config); + parser->current_logical_monitor_config = NULL; - parser->state = STATE_CONFIGURATION; - return; - } + parser->state = STATE_CONFIGURATION; + return; + } case STATE_MIGRATED: - { - g_assert (g_str_equal (element_name, "migrated")); + { + g_assert (g_str_equal (element_name, "migrated")); - parser->state = STATE_CONFIGURATION; - return; - } + parser->state = STATE_CONFIGURATION; + return; + } case STATE_DISABLED: - { - g_assert (g_str_equal (element_name, "disabled")); + { + g_assert (g_str_equal (element_name, "disabled")); - parser->state = STATE_CONFIGURATION; - return; - } + parser->state = STATE_CONFIGURATION; + return; + } case STATE_CONFIGURATION: - { - MetaMonitorConfigStore *store = parser->config_store; - MetaMonitorsConfig *config; - GList *l; - MetaLogicalMonitorLayoutMode layout_mode; - MetaMonitorsConfigFlag config_flags = META_MONITORS_CONFIG_FLAG_NONE; - - g_assert (g_str_equal (element_name, "configuration")); - - if (parser->current_was_migrated) - layout_mode = META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL; - else - layout_mode = - meta_monitor_manager_get_default_layout_mode (store->monitor_manager); - - for (l = parser->current_logical_monitor_configs; l; l = l->next) - { - MetaLogicalMonitorConfig *logical_monitor_config = l->data; - - if (!derive_logical_monitor_layout (logical_monitor_config, - layout_mode, - error)) - return; - - if (!meta_verify_logical_monitor_config (logical_monitor_config, - layout_mode, - store->monitor_manager, - error)) - return; - } - - if (parser->current_was_migrated) - config_flags |= META_MONITORS_CONFIG_FLAG_MIGRATED; - - config = - meta_monitors_config_new_full (parser->current_logical_monitor_configs, - parser->current_disabled_monitor_specs, - layout_mode, - config_flags); - - parser->current_logical_monitor_configs = NULL; - parser->current_disabled_monitor_specs = NULL; - - if (!meta_verify_monitors_config (config, store->monitor_manager, - error)) - { - g_object_unref (config); + { + MetaMonitorConfigStore *store = parser->config_store; + MetaMonitorsConfig *config; + GList *l; + MetaLogicalMonitorLayoutMode layout_mode; + MetaMonitorsConfigFlag config_flags = META_MONITORS_CONFIG_FLAG_NONE; + + g_assert (g_str_equal (element_name, "configuration")); + + if (parser->current_was_migrated) + layout_mode = META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL; + else + layout_mode = + meta_monitor_manager_get_default_layout_mode (store->monitor_manager); + + for (l = parser->current_logical_monitor_configs; l; l = l->next) + { + MetaLogicalMonitorConfig *logical_monitor_config = l->data; + + if (!derive_logical_monitor_layout (logical_monitor_config, + layout_mode, + error)) + return; + + if (!meta_verify_logical_monitor_config (logical_monitor_config, + layout_mode, + store->monitor_manager, + error)) return; - } + } - g_hash_table_replace (parser->config_store->configs, - config->key, config); + if (parser->current_was_migrated) + config_flags |= META_MONITORS_CONFIG_FLAG_MIGRATED; - parser->state = STATE_MONITORS; - return; - } + config = + meta_monitors_config_new_full (parser->current_logical_monitor_configs, + parser->current_disabled_monitor_specs, + layout_mode, + config_flags); + + parser->current_logical_monitor_configs = NULL; + parser->current_disabled_monitor_specs = NULL; + + if (!meta_verify_monitors_config (config, store->monitor_manager, + error)) + { + g_object_unref (config); + return; + } + + g_hash_table_replace (parser->config_store->configs, + config->key, config); + + parser->state = STATE_MONITORS; + return; + } case STATE_MONITORS: - { - g_assert (g_str_equal (element_name, "monitors")); + { + g_assert (g_str_equal (element_name, "monitors")); - parser->state = STATE_INITIAL; - return; - } + parser->state = STATE_INITIAL; + return; + } case STATE_INITIAL: - { - g_assert_not_reached (); - } + { + g_assert_not_reached (); + } } } static gboolean -read_int (const char *text, - gsize text_len, - gint *out_value, - GError **error) +read_int (const char *text, + gsize text_len, + gint *out_value, + GError **error) { char buf[64]; int64_t value; @@ -833,10 +837,10 @@ read_int (const char *text, } static gboolean -read_float (const char *text, - gsize text_len, - float *out_value, - GError **error) +read_float (const char *text, + gsize text_len, + float *out_value, + GError **error) { char buf[64]; float value; @@ -861,10 +865,10 @@ read_float (const char *text, } static gboolean -read_bool (const char *text, - gsize text_len, - gboolean *out_value, - GError **error) +read_bool (const char *text, + gsize text_len, + gboolean *out_value, + GError **error) { if (strncmp (text, "no", text_len) == 0) { @@ -918,160 +922,161 @@ handle_text (GMarkupParseContext *context, case STATE_MONITOR_MODE: case STATE_TRANSFORM: case STATE_DISABLED: - { - if (!is_all_whitespace (text, text_len)) - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, - "Unexpected content at this point"); - return; - } + { + if (!is_all_whitespace (text, text_len)) + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, + "Unexpected content at this point"); + return; + } case STATE_MONITOR_SPEC_CONNECTOR: - { - parser->current_monitor_spec->connector = g_strndup (text, text_len); - return; - } + { + parser->current_monitor_spec->connector = g_strndup (text, text_len); + return; + } case STATE_MONITOR_SPEC_VENDOR: - { - parser->current_monitor_spec->vendor = g_strndup (text, text_len); - return; - } + { + parser->current_monitor_spec->vendor = g_strndup (text, text_len); + return; + } case STATE_MONITOR_SPEC_PRODUCT: - { - parser->current_monitor_spec->product = g_strndup (text, text_len); - return; - } + { + parser->current_monitor_spec->product = g_strndup (text, text_len); + return; + } case STATE_MONITOR_SPEC_SERIAL: - { - parser->current_monitor_spec->serial = g_strndup (text, text_len); - return; - } + { + parser->current_monitor_spec->serial = g_strndup (text, text_len); + return; + } case STATE_LOGICAL_MONITOR_X: - { - read_int (text, text_len, - &parser->current_logical_monitor_config->layout.x, error); - return; - } + { + read_int (text, text_len, + &parser->current_logical_monitor_config->layout.x, error); + return; + } case STATE_LOGICAL_MONITOR_Y: - { - read_int (text, text_len, - &parser->current_logical_monitor_config->layout.y, error); - return; - } + { + read_int (text, text_len, + &parser->current_logical_monitor_config->layout.y, error); + return; + } case STATE_LOGICAL_MONITOR_SCALE: - { - if (!read_float (text, text_len, - &parser->current_logical_monitor_config->scale, error)) - return; + { + if (!read_float (text, text_len, + &parser->current_logical_monitor_config->scale, error)) + return; - if (parser->current_logical_monitor_config->scale <= 0.0) - { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "Logical monitor scale '%g' invalid", - parser->current_logical_monitor_config->scale); - return; - } + if (parser->current_logical_monitor_config->scale <= 0.0) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Logical monitor scale '%g' invalid", + parser->current_logical_monitor_config->scale); + return; + } - return; - } + return; + } case STATE_LOGICAL_MONITOR_PRIMARY: - { - read_bool (text, text_len, - &parser->current_logical_monitor_config->is_primary, - error); - return; - } + { + read_bool (text, text_len, + &parser->current_logical_monitor_config->is_primary, + error); + return; + } case STATE_LOGICAL_MONITOR_PRESENTATION: - { - read_bool (text, text_len, - &parser->current_logical_monitor_config->is_presentation, - error); - return; - } + { + read_bool (text, text_len, + &parser->current_logical_monitor_config->is_presentation, + error); + return; + } case STATE_TRANSFORM_ROTATION: - { - if (strncmp (text, "normal", text_len) == 0) - parser->current_transform = META_MONITOR_TRANSFORM_NORMAL; - else if (strncmp (text, "left", text_len) == 0) - parser->current_transform = META_MONITOR_TRANSFORM_90; - else if (strncmp (text, "upside_down", text_len) == 0) - parser->current_transform = META_MONITOR_TRANSFORM_180; - else if (strncmp (text, "right", text_len) == 0) - parser->current_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); + { + if (strncmp (text, "normal", text_len) == 0) + parser->current_transform = META_MONITOR_TRANSFORM_NORMAL; + else if (strncmp (text, "left", text_len) == 0) + parser->current_transform = META_MONITOR_TRANSFORM_90; + else if (strncmp (text, "upside_down", text_len) == 0) + parser->current_transform = META_MONITOR_TRANSFORM_180; + else if (strncmp (text, "right", text_len) == 0) + parser->current_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); - return; - } + return; + } case STATE_TRANSFORM_FLIPPED: - { - read_bool (text, text_len, - &parser->current_transform_flipped, - error); - return; - } + { + read_bool (text, text_len, + &parser->current_transform_flipped, + error); + return; + } case STATE_MONITOR_MODE_WIDTH: - { - read_int (text, text_len, - &parser->current_monitor_mode_spec->width, - error); - return; - } + { + read_int (text, text_len, + &parser->current_monitor_mode_spec->width, + error); + return; + } case STATE_MONITOR_MODE_HEIGHT: - { - read_int (text, text_len, - &parser->current_monitor_mode_spec->height, - error); - return; - } + { + read_int (text, text_len, + &parser->current_monitor_mode_spec->height, + error); + return; + } case STATE_MONITOR_MODE_RATE: - { - read_float (text, text_len, - &parser->current_monitor_mode_spec->refresh_rate, - error); - return; - } + { + read_float (text, text_len, + &parser->current_monitor_mode_spec->refresh_rate, + error); + return; + } case STATE_MONITOR_MODE_FLAG: - { - if (strncmp (text, "interlace", text_len) == 0) - { - parser->current_monitor_mode_spec->flags |= - META_CRTC_MODE_FLAG_INTERLACE; - } - else - { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, - "Invalid mode flag %.*s", (int) text_len, text); - } + { + if (strncmp (text, "interlace", text_len) == 0) + { + parser->current_monitor_mode_spec->flags |= + META_CRTC_MODE_FLAG_INTERLACE; + } + else + { + g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, + "Invalid mode flag %.*s", (int) text_len, text); + } - return; - } + return; + } case STATE_MONITOR_UNDERSCANNING: - { - read_bool (text, text_len, - &parser->current_monitor_config->enable_underscanning, - error); - return; - } + { + read_bool (text, text_len, + &parser->current_monitor_config->enable_underscanning, + error); + return; + } } } -static const GMarkupParser config_parser = { +static const GMarkupParser config_parser = +{ .start_element = handle_start_element, .end_element = handle_end_element, .text = handle_text @@ -1107,7 +1112,7 @@ read_config_file (MetaMonitorConfigStore *config_store, meta_monitor_spec_free); g_free (parser.current_monitor_mode_spec); g_clear_pointer (&parser.current_monitor_config, - meta_monitor_config_free); + meta_monitor_config_free); g_clear_pointer (&parser.current_logical_monitor_config, meta_logical_monitor_config_free); return FALSE; @@ -1175,7 +1180,8 @@ append_monitors (GString *buffer, g_string_append_printf (buffer, " <flag>interlace</flag>\n"); g_string_append (buffer, " </mode>\n"); if (monitor_config->enable_underscanning) - g_string_append (buffer, " <underscanning>yes</underscanning>\n"); + g_string_append (buffer, + " <underscanning>yes</underscanning>\n"); g_string_append (buffer, " </monitor>\n"); } } @@ -1324,7 +1330,8 @@ saved_cb (GObject *object, { if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { - g_warning ("Saving monitor configuration failed: %s\n", error->message); + g_warning ("Saving monitor configuration failed: %s\n", + error->message); g_clear_object (&data->config_store->save_cancellable); } @@ -1468,7 +1475,8 @@ meta_monitor_config_store_get_config_count (MetaMonitorConfigStore *config_store } MetaMonitorManager * -meta_monitor_config_store_get_monitor_manager (MetaMonitorConfigStore *config_store) +meta_monitor_config_store_get_monitor_manager ( + MetaMonitorConfigStore *config_store) { return config_store->monitor_manager; } diff --git a/src/backends/meta-monitor-manager-dummy.c b/src/backends/meta-monitor-manager-dummy.c index f11bf5cf7..2775a8ed2 100644 --- a/src/backends/meta-monitor-manager-dummy.c +++ b/src/backends/meta-monitor-manager-dummy.c @@ -62,7 +62,8 @@ typedef struct _MetaOutputDummy float scale; } MetaOutputDummy; -G_DEFINE_TYPE (MetaMonitorManagerDummy, meta_monitor_manager_dummy, META_TYPE_MONITOR_MANAGER); +G_DEFINE_TYPE (MetaMonitorManagerDummy, meta_monitor_manager_dummy, + META_TYPE_MONITOR_MANAGER); struct _MetaGpuDummy { @@ -106,7 +107,8 @@ append_monitor (MetaMonitorManager *manager, { MetaMonitorManagerDummy *manager_dummy = META_MONITOR_MANAGER_DUMMY (manager); MetaGpu *gpu = manager_dummy->gpu; - CrtcModeSpec mode_specs[] = { + CrtcModeSpec mode_specs[] = + { { .width = 800, .height = 600, @@ -195,7 +197,8 @@ append_tiled_monitor (MetaMonitorManager *manager, { MetaMonitorManagerDummy *manager_dummy = META_MONITOR_MANAGER_DUMMY (manager); MetaGpu *gpu = manager_dummy->gpu; - CrtcModeSpec mode_specs[] = { + CrtcModeSpec mode_specs[] = + { { .width = 800, .height = 600, @@ -483,7 +486,7 @@ apply_crtc_assignments (MetaMonitorManager *manager, for (j = 0; j < crtc_info->outputs->len; j++) { - output = ((MetaOutput**)crtc_info->outputs->pdata)[j]; + output = ((MetaOutput **) crtc_info->outputs->pdata)[j]; output->is_dirty = TRUE; meta_output_assign_crtc (output, crtc); @@ -566,10 +569,11 @@ update_screen_size (MetaMonitorManager *manager, } static gboolean -meta_monitor_manager_dummy_apply_monitors_config (MetaMonitorManager *manager, - MetaMonitorsConfig *config, - MetaMonitorsConfigMethod method, - GError **error) +meta_monitor_manager_dummy_apply_monitors_config ( + MetaMonitorManager *manager, + MetaMonitorsConfig *config, + MetaMonitorsConfigMethod method, + GError **error) { GPtrArray *crtc_infos; GPtrArray *output_infos; @@ -621,9 +625,10 @@ meta_monitor_manager_dummy_is_transform_handled (MetaMonitorManager *manager, } static float -meta_monitor_manager_dummy_calculate_monitor_mode_scale (MetaMonitorManager *manager, - MetaMonitor *monitor, - MetaMonitorMode *monitor_mode) +meta_monitor_manager_dummy_calculate_monitor_mode_scale ( + MetaMonitorManager *manager, + MetaMonitor *monitor, + MetaMonitorMode *monitor_mode) { MetaOutput *output; MetaOutputDummy *output_dummy; @@ -635,11 +640,12 @@ meta_monitor_manager_dummy_calculate_monitor_mode_scale (MetaMonitorManager *man } static float * -meta_monitor_manager_dummy_calculate_supported_scales (MetaMonitorManager *manager, - MetaLogicalMonitorLayoutMode layout_mode, - MetaMonitor *monitor, - MetaMonitorMode *monitor_mode, - int *n_supported_scales) +meta_monitor_manager_dummy_calculate_supported_scales ( + MetaMonitorManager *manager, + MetaLogicalMonitorLayoutMode layout_mode, + MetaMonitor *monitor, + MetaMonitorMode *monitor_mode, + int *n_supported_scales) { MetaMonitorScalesConstraint constraints = META_MONITOR_SCALES_CONSTRAINT_NONE; @@ -718,14 +724,21 @@ meta_monitor_manager_dummy_class_init (MetaMonitorManagerDummyClass *klass) { MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_CLASS (klass); - manager_class->ensure_initial_config = meta_monitor_manager_dummy_ensure_initial_config; - manager_class->apply_monitors_config = meta_monitor_manager_dummy_apply_monitors_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->calculate_supported_scales = meta_monitor_manager_dummy_calculate_supported_scales; + manager_class->ensure_initial_config = + meta_monitor_manager_dummy_ensure_initial_config; + manager_class->apply_monitors_config = + meta_monitor_manager_dummy_apply_monitors_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->calculate_supported_scales = + meta_monitor_manager_dummy_calculate_supported_scales; manager_class->get_capabilities = meta_monitor_manager_dummy_get_capabilities; - manager_class->get_max_screen_size = meta_monitor_manager_dummy_get_max_screen_size; - manager_class->get_default_layout_mode = meta_monitor_manager_dummy_get_default_layout_mode; + manager_class->get_max_screen_size = + meta_monitor_manager_dummy_get_max_screen_size; + manager_class->get_default_layout_mode = + meta_monitor_manager_dummy_get_default_layout_mode; } static void @@ -748,8 +761,8 @@ meta_monitor_manager_dummy_init (MetaMonitorManagerDummy *manager_dummy) } static gboolean -meta_gpu_dummy_read_current (MetaGpu *gpu, - GError **error) +meta_gpu_dummy_read_current (MetaGpu *gpu, + GError **error) { MetaMonitorManager *manager = meta_gpu_get_monitor_manager (gpu); diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c index a411055fc..896201e6b 100644 --- a/src/backends/meta-monitor-manager.c +++ b/src/backends/meta-monitor-manager.c @@ -58,30 +58,36 @@ enum static GParamSpec *obj_props[PROP_LAST]; -enum { +enum +{ MONITORS_CHANGED_INTERNAL, CONFIRM_DISPLAY_CHANGE, SIGNALS_LAST }; /* Array index matches MetaMonitorTransform */ -static gfloat transform_matrices[][6] = { - { 1, 0, 0, 0, 1, 0 }, /* normal */ - { 0, -1, 1, 1, 0, 0 }, /* 90° */ - { -1, 0, 1, 0, -1, 1 }, /* 180° */ - { 0, 1, 0, -1, 0, 1 }, /* 270° */ - { -1, 0, 1, 0, 1, 0 }, /* normal flipped */ - { 0, 1, 0, 1, 0, 0 }, /* 90° flipped */ - { 1, 0, 0, 0, -1, 1 }, /* 180° flipped */ - { 0, -1, 1, -1, 0, 1 }, /* 270° flipped */ +static gfloat transform_matrices[][6] = +{ + { 1, 0, 0, 0, 1, 0 }, /* normal */ + { 0, -1, 1, 1, 0, 0 }, /* 90° */ + { -1, 0, 1, 0, -1, 1 }, /* 180° */ + { 0, 1, 0, -1, 0, 1 }, /* 270° */ + { -1, 0, 1, 0, 1, 0 }, /* normal flipped */ + { 0, 1, 0, 1, 0, 0 }, /* 90° flipped */ + { 1, 0, 0, 0, -1, 1 }, /* 180° flipped */ + { 0, -1, 1, -1, 0, 1 }, /* 270° flipped */ }; static int signals[SIGNALS_LAST]; -static void meta_monitor_manager_display_config_init (MetaDBusDisplayConfigIface *iface); +static void meta_monitor_manager_display_config_init ( + MetaDBusDisplayConfigIface *iface); -G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaMonitorManager, meta_monitor_manager, META_DBUS_TYPE_DISPLAY_CONFIG_SKELETON, - G_IMPLEMENT_INTERFACE (META_DBUS_TYPE_DISPLAY_CONFIG, meta_monitor_manager_display_config_init)); +G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaMonitorManager, meta_monitor_manager, + META_DBUS_TYPE_DISPLAY_CONFIG_SKELETON, + G_IMPLEMENT_INTERFACE ( + META_DBUS_TYPE_DISPLAY_CONFIG, + meta_monitor_manager_display_config_init)); static void initialize_dbus_interface (MetaMonitorManager *manager); @@ -234,8 +240,9 @@ derive_scale_from_config (MetaMonitorManager *manager, } static void -meta_monitor_manager_rebuild_logical_monitors_derived (MetaMonitorManager *manager, - MetaMonitorsConfig *config) +meta_monitor_manager_rebuild_logical_monitors_derived ( + MetaMonitorManager *manager, + MetaMonitorsConfig *config) { GList *logical_monitors = NULL; GList *l; @@ -320,7 +327,8 @@ power_save_mode_changed (MetaMonitorManager *manager, gpointer user_data) { MetaMonitorManagerClass *klass; - int mode = meta_dbus_display_config_get_power_save_mode (META_DBUS_DISPLAY_CONFIG (manager)); + int mode = meta_dbus_display_config_get_power_save_mode (META_DBUS_DISPLAY_CONFIG ( + manager)); if (mode == META_POWER_SAVE_UNSUPPORTED) return; @@ -328,7 +336,9 @@ power_save_mode_changed (MetaMonitorManager *manager, /* If DPMS is unsupported, force the property back. */ if (manager->power_save_mode == META_POWER_SAVE_UNSUPPORTED) { - meta_dbus_display_config_set_power_save_mode (META_DBUS_DISPLAY_CONFIG (manager), META_POWER_SAVE_UNSUPPORTED); + meta_dbus_display_config_set_power_save_mode (META_DBUS_DISPLAY_CONFIG ( + manager), + META_POWER_SAVE_UNSUPPORTED); return; } @@ -374,11 +384,12 @@ meta_monitor_manager_calculate_monitor_mode_scale (MetaMonitorManager *manager, } float * -meta_monitor_manager_calculate_supported_scales (MetaMonitorManager *manager, - MetaLogicalMonitorLayoutMode layout_mode, - MetaMonitor *monitor, - MetaMonitorMode *monitor_mode, - int *n_supported_scales) +meta_monitor_manager_calculate_supported_scales ( + MetaMonitorManager *manager, + MetaLogicalMonitorLayoutMode layout_mode, + MetaMonitor *monitor, + MetaMonitorMode *monitor_mode, + int *n_supported_scales) { MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_GET_CLASS (manager); @@ -516,7 +527,8 @@ meta_monitor_manager_ensure_configured (MetaMonitorManager *manager) } } - config = meta_monitor_config_manager_create_suggested (manager->config_manager); + config = + meta_monitor_config_manager_create_suggested (manager->config_manager); if (config) { if (!meta_monitor_manager_apply_monitors_config (manager, @@ -561,8 +573,9 @@ meta_monitor_manager_ensure_configured (MetaMonitorManager *manager) } config = - meta_monitor_config_manager_create_for_switch_config (manager->config_manager, - META_MONITOR_SWITCH_CONFIG_ALL_LINEAR); + meta_monitor_config_manager_create_for_switch_config ( + manager->config_manager, + META_MONITOR_SWITCH_CONFIG_ALL_LINEAR); if (config) { if (!meta_monitor_manager_apply_monitors_config (manager, @@ -581,7 +594,8 @@ meta_monitor_manager_ensure_configured (MetaMonitorManager *manager) } } - config = meta_monitor_config_manager_create_fallback (manager->config_manager); + config = + meta_monitor_config_manager_create_fallback (manager->config_manager); if (config) { if (!meta_monitor_manager_apply_monitors_config (manager, @@ -836,11 +850,11 @@ meta_monitor_manager_class_init (MetaMonitorManagerClass *klass) signals[CONFIRM_DISPLAY_CHANGE] = g_signal_new ("confirm-display-change", - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - 0, + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, NULL, - G_TYPE_NONE, 0); + G_TYPE_NONE, 0); obj_props[PROP_BACKEND] = g_param_spec_object ("backend", @@ -853,10 +867,11 @@ meta_monitor_manager_class_init (MetaMonitorManagerClass *klass) g_object_class_install_properties (object_class, PROP_LAST, obj_props); } -static const double known_diagonals[] = { - 12.1, - 13.3, - 15.6 +static const double known_diagonals[] = +{ + 12.1, + 13.3, + 15.6 }; static char * @@ -868,7 +883,7 @@ diagonal_to_str (double d) { double delta; - delta = fabs(known_diagonals[i] - d); + delta = fabs (known_diagonals[i] - d); if (delta < 0.1) return g_strdup_printf ("%0.1lf\"", known_diagonals[i]); } @@ -884,7 +899,7 @@ make_display_name (MetaMonitorManager *manager, g_autofree char *vendor_name = NULL; if (meta_output_is_laptop (output)) - return g_strdup (_("Built-in display")); + return g_strdup (_("Built-in display")); if (output->width_mm > 0 && output->height_mm > 0) { @@ -952,8 +967,8 @@ get_connector_type_name (MetaConnectorType connector_type) } static GList * -combine_gpu_lists (MetaMonitorManager *manager, - GList * (*list_getter) (MetaGpu *gpu)) +combine_gpu_lists (MetaMonitorManager *manager, + GList * (*list_getter)(MetaGpu *gpu)) { GList *list = NULL; GList *l; @@ -973,7 +988,8 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton, GDBusMethodInvocation *invocation) { MetaMonitorManager *manager = META_MONITOR_MANAGER (skeleton); - MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_GET_CLASS (skeleton); + MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_GET_CLASS ( + skeleton); GList *combined_modes; GList *combined_outputs; GList *combined_crtcs; @@ -988,7 +1004,8 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton, combined_crtcs = combine_gpu_lists (manager, meta_gpu_get_crtcs); g_variant_builder_init (&crtc_builder, G_VARIANT_TYPE ("a(uxiiiiiuaua{sv})")); - g_variant_builder_init (&output_builder, G_VARIANT_TYPE ("a(uxiausauaua{sv})")); + g_variant_builder_init (&output_builder, + G_VARIANT_TYPE ("a(uxiausauaua{sv})")); g_variant_builder_init (&mode_builder, G_VARIANT_TYPE ("a(uxuudu)")); for (l = combined_crtcs, i = 0; l; l = l->next, i++) @@ -1008,13 +1025,13 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton, current_mode_index = -1; g_variant_builder_add (&crtc_builder, "(uxiiiiiuaua{sv})", i, /* ID */ - (gint64)crtc->crtc_id, - (int)crtc->rect.x, - (int)crtc->rect.y, - (int)crtc->rect.width, - (int)crtc->rect.height, + (gint64) crtc->crtc_id, + (int) crtc->rect.x, + (int) crtc->rect.y, + (int) crtc->rect.width, + (int) crtc->rect.height, current_mode_index, - (guint32)crtc->transform, + (guint32) crtc->transform, &transforms, NULL /* properties */); } @@ -1069,22 +1086,28 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton, g_variant_builder_add (&properties, "{sv}", "height-mm", g_variant_new_int32 (output->height_mm)); g_variant_builder_add (&properties, "{sv}", "display-name", - g_variant_new_take_string (make_display_name (manager, output))); + g_variant_new_take_string (make_display_name ( + manager, output))); g_variant_builder_add (&properties, "{sv}", "backlight", g_variant_new_int32 (output->backlight)); g_variant_builder_add (&properties, "{sv}", "min-backlight-step", - g_variant_new_int32 ((output->backlight_max - output->backlight_min) ? - 100 / (output->backlight_max - output->backlight_min) : -1)); + g_variant_new_int32 ((output->backlight_max - + output->backlight_min) ? + 100 / + (output->backlight_max - + output->backlight_min) : -1)); g_variant_builder_add (&properties, "{sv}", "primary", g_variant_new_boolean (output->is_primary)); g_variant_builder_add (&properties, "{sv}", "presentation", g_variant_new_boolean (output->is_presentation)); g_variant_builder_add (&properties, "{sv}", "connector-type", - g_variant_new_string (get_connector_type_name (output->connector_type))); + g_variant_new_string (get_connector_type_name ( + output->connector_type))); g_variant_builder_add (&properties, "{sv}", "underscanning", g_variant_new_boolean (output->is_underscanning)); g_variant_builder_add (&properties, "{sv}", "supports-underscanning", - g_variant_new_boolean (output->supports_underscanning)); + g_variant_new_boolean (output-> + supports_underscanning)); edid_file = manager_class->get_edid_file (manager, output); if (edid_file) @@ -1099,7 +1122,8 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton, if (edid) { g_variant_builder_add (&properties, "{sv}", "edid", - g_variant_new_from_bytes (G_VARIANT_TYPE ("ay"), + g_variant_new_from_bytes (G_VARIANT_TYPE ( + "ay"), edid, TRUE)); g_bytes_unref (edid); } @@ -1123,7 +1147,7 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton, crtc_index = crtc ? g_list_index (combined_crtcs, crtc) : -1; g_variant_builder_add (&output_builder, "(uxiausauaua{sv})", i, /* ID */ - (gint64)output->winsys_id, + (gint64) output->winsys_id, crtc_index, &crtcs, output->name, @@ -1138,11 +1162,11 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton, g_variant_builder_add (&mode_builder, "(uxuudu)", i, /* ID */ - (gint64)mode->mode_id, - (guint32)mode->width, - (guint32)mode->height, - (double)mode->refresh_rate, - (guint32)mode->flags); + (gint64) mode->mode_id, + (guint32) mode->width, + (guint32) mode->height, + (double) mode->refresh_rate, + (guint32) mode->flags); } if (!meta_monitor_manager_get_max_screen_size (manager, @@ -1157,9 +1181,12 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton, meta_dbus_display_config_complete_get_resources (skeleton, invocation, manager->serial, - g_variant_builder_end (&crtc_builder), - g_variant_builder_end (&output_builder), - g_variant_builder_end (&mode_builder), + g_variant_builder_end (& + crtc_builder), + g_variant_builder_end (& + output_builder), + g_variant_builder_end (& + mode_builder), max_screen_width, max_screen_height); @@ -1231,9 +1258,10 @@ cancel_persistent_confirmation (MetaMonitorManager *manager) static void request_persistent_confirmation (MetaMonitorManager *manager) { - manager->persistent_timeout_id = g_timeout_add_seconds (meta_monitor_manager_get_display_configuration_timeout (), - save_config_timeout, - manager); + manager->persistent_timeout_id = g_timeout_add_seconds ( + meta_monitor_manager_get_display_configuration_timeout (), + save_config_timeout, + manager); g_source_set_name_by_id (manager->persistent_timeout_id, "[mutter] save_config_timeout"); @@ -1633,7 +1661,6 @@ create_monitor_config_from_variant (MetaMonitorManager *manager, GVariant *monitor_config_variant, GError **error) { - MetaMonitorConfig *monitor_config = NULL; g_autofree char *connector = NULL; g_autofree char *mode_id = NULL; @@ -1665,7 +1692,8 @@ create_monitor_config_from_variant (MetaMonitorManager *manager, return NULL; } - g_variant_lookup (properties_variant, "underscanning", "b", &enable_underscanning); + g_variant_lookup (properties_variant, "underscanning", "b", + &enable_underscanning); monitor_spec = meta_monitor_spec_clone (meta_monitor_get_spec (monitor)); @@ -1781,10 +1809,11 @@ derive_logical_monitor_size (MetaMonitorConfig *monitor_config, } static MetaLogicalMonitorConfig * -create_logical_monitor_config_from_variant (MetaMonitorManager *manager, - GVariant *logical_monitor_config_variant, - MetaLogicalMonitorLayoutMode layout_mode, - GError **error) +create_logical_monitor_config_from_variant ( + MetaMonitorManager *manager, + GVariant *logical_monitor_config_variant, + MetaLogicalMonitorLayoutMode layout_mode, + GError **error) { MetaLogicalMonitorConfig *logical_monitor_config; int x, y, width, height; @@ -1854,7 +1883,8 @@ create_logical_monitor_config_from_variant (MetaMonitorManager *manager logical_monitor_config = g_new0 (MetaLogicalMonitorConfig, 1); *logical_monitor_config = (MetaLogicalMonitorConfig) { - .layout = { + .layout = + { .x = x, .y = y, .width = width, @@ -1896,12 +1926,13 @@ is_valid_layout_mode (MetaLogicalMonitorLayoutMode layout_mode) } static gboolean -meta_monitor_manager_handle_apply_monitors_config (MetaDBusDisplayConfig *skeleton, - GDBusMethodInvocation *invocation, - guint serial, - guint method, - GVariant *logical_monitor_configs_variant, - GVariant *properties_variant) +meta_monitor_manager_handle_apply_monitors_config ( + MetaDBusDisplayConfig *skeleton, + GDBusMethodInvocation *invocation, + guint serial, + guint method, + GVariant *logical_monitor_configs_variant, + GVariant *properties_variant) { MetaMonitorManager *manager = META_MONITOR_MANAGER (skeleton); MetaMonitorManagerCapability capabilities; @@ -2030,7 +2061,8 @@ meta_monitor_manager_handle_apply_monitors_config (MetaDBusDisplayConfig *skelet if (method == META_MONITORS_CONFIG_METHOD_PERSISTENT) request_persistent_confirmation (manager); - meta_dbus_display_config_complete_apply_monitors_config (skeleton, invocation); + meta_dbus_display_config_complete_apply_monitors_config (skeleton, + invocation); return TRUE; } @@ -2113,9 +2145,11 @@ meta_monitor_manager_handle_change_backlight (MetaDBusDisplayConfig *skeleton, return TRUE; } - META_MONITOR_MANAGER_GET_CLASS (manager)->change_backlight (manager, output, value); + META_MONITOR_MANAGER_GET_CLASS (manager)->change_backlight (manager, output, + value); - meta_dbus_display_config_complete_change_backlight (skeleton, invocation, output->backlight); + meta_dbus_display_config_complete_change_backlight (skeleton, invocation, + output->backlight); return TRUE; } @@ -2230,9 +2264,9 @@ meta_monitor_manager_handle_set_crtc_gamma (MetaDBusDisplayConfig *skeleton, blue_bytes = g_variant_get_data_as_bytes (blue_v); size = g_bytes_get_size (red_bytes) / sizeof (unsigned short); - red = (unsigned short*) g_bytes_get_data (red_bytes, &dummy); - green = (unsigned short*) g_bytes_get_data (green_bytes, &dummy); - blue = (unsigned short*) g_bytes_get_data (blue_bytes, &dummy); + red = (unsigned short *) g_bytes_get_data (red_bytes, &dummy); + green = (unsigned short *) g_bytes_get_data (green_bytes, &dummy); + blue = (unsigned short *) g_bytes_get_data (blue_bytes, &dummy); klass = META_MONITOR_MANAGER_GET_CLASS (manager); if (klass->set_crtc_gamma) @@ -2253,8 +2287,10 @@ meta_monitor_manager_display_config_init (MetaDBusDisplayConfigIface *iface) iface->handle_change_backlight = meta_monitor_manager_handle_change_backlight; iface->handle_get_crtc_gamma = meta_monitor_manager_handle_get_crtc_gamma; iface->handle_set_crtc_gamma = meta_monitor_manager_handle_set_crtc_gamma; - iface->handle_get_current_state = meta_monitor_manager_handle_get_current_state; - iface->handle_apply_monitors_config = meta_monitor_manager_handle_apply_monitors_config; + iface->handle_get_current_state = + meta_monitor_manager_handle_get_current_state; + iface->handle_apply_monitors_config = + meta_monitor_manager_handle_apply_monitors_config; } static void @@ -2329,10 +2365,12 @@ meta_monitor_manager_get_logical_monitors (MetaMonitorManager *manager) } MetaLogicalMonitor * -meta_monitor_manager_get_logical_monitor_from_number (MetaMonitorManager *manager, - int number) +meta_monitor_manager_get_logical_monitor_from_number ( + MetaMonitorManager *manager, + int number) { - g_return_val_if_fail ((unsigned int) number < g_list_length (manager->logical_monitors), NULL); + g_return_val_if_fail ((unsigned int) number < + g_list_length (manager->logical_monitors), NULL); return g_list_nth (manager->logical_monitors, number)->data; } @@ -2345,7 +2383,7 @@ meta_monitor_manager_get_primary_logical_monitor (MetaMonitorManager *manager) static MetaMonitor * find_monitor (MetaMonitorManager *monitor_manager, - gboolean (*match_func) (MetaMonitor *monitor)) + gboolean (*match_func)(MetaMonitor *monitor)) { GList *monitors; GList *l; @@ -2784,7 +2822,8 @@ meta_output_parse_edid (MetaOutput *output, output->product[0] == '\0') { g_clear_pointer (&output->product, g_free); - output->product = g_strdup_printf ("0x%04x", (unsigned) parsed_edid->product_code); + output->product = g_strdup_printf ("0x%04x", + (unsigned) parsed_edid->product_code); } output->serial = g_strndup (parsed_edid->dsc_serial_number, 14); @@ -2792,13 +2831,14 @@ meta_output_parse_edid (MetaOutput *output, output->serial[0] == '\0') { g_clear_pointer (&output->serial, g_free); - output->serial = g_strdup_printf ("0x%08x", parsed_edid->serial_number); + output->serial = + g_strdup_printf ("0x%08x", parsed_edid->serial_number); } g_free (parsed_edid); } - out: +out: if (!output->vendor) output->vendor = g_strdup ("unknown"); if (!output->product) @@ -2837,7 +2877,7 @@ calculate_viewport_matrix (MetaMonitorManager *manager, x = (float) logical_monitor->rect.x / manager->screen_width; y = (float) logical_monitor->rect.y / manager->screen_height; - width = (float) logical_monitor->rect.width / manager->screen_width; + width = (float) logical_monitor->rect.width / manager->screen_width; height = (float) logical_monitor->rect.height / manager->screen_height; viewport[0] = width; @@ -2852,8 +2892,8 @@ calculate_viewport_matrix (MetaMonitorManager *manager, static inline void multiply_matrix (float a[6], - float b[6], - float res[6]) + float b[6], + float res[6]) { res[0] = a[0] * b[0] + a[1] * b[3]; res[1] = a[0] * b[1] + a[1] * b[4]; @@ -2928,7 +2968,8 @@ meta_monitor_manager_rotate_monitor (MetaMonitorManager *manager) { GError *error = NULL; MetaMonitorsConfig *config = - meta_monitor_config_manager_create_for_rotate_monitor (manager->config_manager); + meta_monitor_config_manager_create_for_rotate_monitor ( + manager->config_manager); if (!config) return; @@ -2946,8 +2987,8 @@ meta_monitor_manager_rotate_monitor (MetaMonitorManager *manager) } void -meta_monitor_manager_switch_config (MetaMonitorManager *manager, - MetaMonitorSwitchConfigType config_type) +meta_monitor_manager_switch_config (MetaMonitorManager *manager, + MetaMonitorSwitchConfigType config_type) { GError *error = NULL; MetaMonitorsConfig *config; @@ -2955,8 +2996,9 @@ meta_monitor_manager_switch_config (MetaMonitorManager *manager, g_return_if_fail (config_type != META_MONITOR_SWITCH_CONFIG_UNKNOWN); config = - meta_monitor_config_manager_create_for_switch_config (manager->config_manager, - config_type); + meta_monitor_config_manager_create_for_switch_config ( + manager->config_manager, + config_type); if (!config) return; diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c index 60f36741a..c02edb13c 100644 --- a/src/backends/meta-monitor.c +++ b/src/backends/meta-monitor.c @@ -123,7 +123,8 @@ gboolean meta_monitor_spec_equals (MetaMonitorSpec *monitor_spec, MetaMonitorSpec *other_monitor_spec) { - return (g_str_equal (monitor_spec->connector, other_monitor_spec->connector) && + return (g_str_equal (monitor_spec->connector, + other_monitor_spec->connector) && g_str_equal (monitor_spec->vendor, other_monitor_spec->vendor) && g_str_equal (monitor_spec->product, other_monitor_spec->product) && g_str_equal (monitor_spec->serial, other_monitor_spec->serial)); @@ -353,8 +354,8 @@ meta_monitor_get_connector_type (MetaMonitor *monitor) } MetaMonitorTransform -meta_monitor_logical_to_crtc_transform (MetaMonitor *monitor, - MetaMonitorTransform transform) +meta_monitor_logical_to_crtc_transform (MetaMonitor *monitor, + MetaMonitorTransform transform) { MetaOutput *output = meta_monitor_get_main_output (monitor); MetaMonitorTransform new_transform; @@ -368,8 +369,8 @@ meta_monitor_logical_to_crtc_transform (MetaMonitor *monitor, } MetaMonitorTransform -meta_monitor_crtc_to_logical_transform (MetaMonitor *monitor, - MetaMonitorTransform transform) +meta_monitor_crtc_to_logical_transform (MetaMonitor *monitor, + MetaMonitorTransform transform) { MetaOutput *output = meta_monitor_get_main_output (monitor); MetaMonitorTransform new_transform; @@ -483,10 +484,10 @@ meta_monitor_create_spec (MetaMonitor *monitor, } return (MetaMonitorModeSpec) { - .width = width, - .height = height, - .refresh_rate = crtc_mode->refresh_rate, - .flags = crtc_mode->flags & HANDLED_CRTC_MODE_FLAGS + .width = width, + .height = height, + .refresh_rate = crtc_mode->refresh_rate, + .flags = crtc_mode->flags & HANDLED_CRTC_MODE_FLAGS }; } @@ -638,7 +639,8 @@ meta_monitor_normal_class_init (MetaMonitorNormalClass *klass) monitor_class->get_main_output = meta_monitor_normal_get_main_output; monitor_class->derive_layout = meta_monitor_normal_derive_layout; monitor_class->calculate_crtc_pos = meta_monitor_normal_calculate_crtc_pos; - monitor_class->get_suggested_position = meta_monitor_normal_get_suggested_position; + monitor_class->get_suggested_position = + meta_monitor_normal_get_suggested_position; } uint32_t @@ -702,37 +704,45 @@ calculate_tile_coordinate (MetaMonitor *monitor, { case META_MONITOR_TRANSFORM_NORMAL: case META_MONITOR_TRANSFORM_FLIPPED: - if (other_output->tile_info.loc_v_tile == output->tile_info.loc_v_tile && + if (other_output->tile_info.loc_v_tile == + output->tile_info.loc_v_tile && other_output->tile_info.loc_h_tile < output->tile_info.loc_h_tile) x += other_output->tile_info.tile_w; - if (other_output->tile_info.loc_h_tile == output->tile_info.loc_h_tile && + if (other_output->tile_info.loc_h_tile == + output->tile_info.loc_h_tile && other_output->tile_info.loc_v_tile < output->tile_info.loc_v_tile) y += other_output->tile_info.tile_h; break; case META_MONITOR_TRANSFORM_180: case META_MONITOR_TRANSFORM_FLIPPED_180: - if (other_output->tile_info.loc_v_tile == output->tile_info.loc_v_tile && + if (other_output->tile_info.loc_v_tile == + output->tile_info.loc_v_tile && other_output->tile_info.loc_h_tile > output->tile_info.loc_h_tile) x += other_output->tile_info.tile_w; - if (other_output->tile_info.loc_h_tile == output->tile_info.loc_h_tile && + if (other_output->tile_info.loc_h_tile == + output->tile_info.loc_h_tile && other_output->tile_info.loc_v_tile > output->tile_info.loc_v_tile) y += other_output->tile_info.tile_h; break; case META_MONITOR_TRANSFORM_270: case META_MONITOR_TRANSFORM_FLIPPED_270: - if (other_output->tile_info.loc_v_tile == output->tile_info.loc_v_tile && + if (other_output->tile_info.loc_v_tile == + output->tile_info.loc_v_tile && other_output->tile_info.loc_h_tile < output->tile_info.loc_h_tile) y += other_output->tile_info.tile_w; - if (other_output->tile_info.loc_h_tile == output->tile_info.loc_h_tile && + if (other_output->tile_info.loc_h_tile == + output->tile_info.loc_h_tile && other_output->tile_info.loc_v_tile < output->tile_info.loc_v_tile) x += other_output->tile_info.tile_h; break; case META_MONITOR_TRANSFORM_90: case META_MONITOR_TRANSFORM_FLIPPED_90: - if (other_output->tile_info.loc_v_tile == output->tile_info.loc_v_tile && + if (other_output->tile_info.loc_v_tile == + output->tile_info.loc_v_tile && other_output->tile_info.loc_h_tile > output->tile_info.loc_h_tile) y += other_output->tile_info.tile_w; - if (other_output->tile_info.loc_h_tile == output->tile_info.loc_h_tile && + if (other_output->tile_info.loc_h_tile == + output->tile_info.loc_h_tile && other_output->tile_info.loc_v_tile > output->tile_info.loc_v_tile) x += other_output->tile_info.tile_h; break; @@ -1318,7 +1328,8 @@ meta_monitor_tiled_class_init (MetaMonitorTiledClass *klass) monitor_class->get_main_output = meta_monitor_tiled_get_main_output; monitor_class->derive_layout = meta_monitor_tiled_derive_layout; monitor_class->calculate_crtc_pos = meta_monitor_tiled_calculate_crtc_pos; - monitor_class->get_suggested_position = meta_monitor_tiled_get_suggested_position; + monitor_class->get_suggested_position = + meta_monitor_tiled_get_suggested_position; } static void @@ -1368,7 +1379,8 @@ meta_monitor_mode_spec_equals (MetaMonitorModeSpec *monitor_mode_spec, return (monitor_mode_spec->width == other_monitor_mode_spec->width && monitor_mode_spec->height == other_monitor_mode_spec->height && ABS (monitor_mode_spec->refresh_rate - - other_monitor_mode_spec->refresh_rate) < MAXIMUM_REFRESH_RATE_DIFF && + other_monitor_mode_spec->refresh_rate) < + MAXIMUM_REFRESH_RATE_DIFF && monitor_mode_spec->flags == other_monitor_mode_spec->flags); } @@ -1485,7 +1497,8 @@ meta_monitor_calculate_crtc_pos (MetaMonitor *monitor, */ #define HIDPI_MIN_HEIGHT 1200 -/* From http://en.wikipedia.org/wiki/4K_resolution#Resolutions_of_common_formats */ +/* From http://en.wikipedia.org/wiki/4K_resolution#Resolutions_of_common_formats + * */ #define SMALLEST_4K_WIDTH 3656 static float @@ -1612,7 +1625,6 @@ get_closest_scale_factor_for_resolution (float width, do { - for (j = 0; j < 2; j++) { float current_scale; diff --git a/src/backends/meta-orientation-manager.c b/src/backends/meta-orientation-manager.c index 4f57248eb..e01e20478 100644 --- a/src/backends/meta-orientation-manager.c +++ b/src/backends/meta-orientation-manager.c @@ -88,10 +88,13 @@ read_iio_proxy (MetaOrientationManager *self) if (has_accel) { - v = g_dbus_proxy_get_cached_property (self->iio_proxy, "AccelerometerOrientation"); + v = g_dbus_proxy_get_cached_property (self->iio_proxy, + "AccelerometerOrientation"); if (v) { - self->curr_orientation = orientation_from_string (g_variant_get_string (v, NULL)); + self->curr_orientation = orientation_from_string (g_variant_get_string ( + v, + NULL)); g_variant_unref (v); } } diff --git a/src/backends/meta-output.c b/src/backends/meta-output.c index 2139a17a3..6dfbaf29f 100644 --- a/src/backends/meta-output.c +++ b/src/backends/meta-output.c @@ -30,7 +30,7 @@ typedef struct _MetaOutputPrivate G_DEFINE_TYPE_WITH_PRIVATE (MetaOutput, meta_output, G_TYPE_OBJECT) MetaGpu * -meta_output_get_gpu (MetaOutput *output) +meta_output_get_gpu (MetaOutput * output) { return output->gpu; } diff --git a/src/backends/meta-pointer-constraint.c b/src/backends/meta-pointer-constraint.c index 40ee3d32f..bd312bdce 100644 --- a/src/backends/meta-pointer-constraint.c +++ b/src/backends/meta-pointer-constraint.c @@ -46,8 +46,8 @@ meta_pointer_constraint_constrain (MetaPointerConstraint *constraint, guint32 time, float prev_x, float prev_y, - float *x, - float *y) + float *x, + float *y) { META_POINTER_CONSTRAINT_GET_CLASS (constraint)->constrain (constraint, device, diff --git a/src/backends/meta-remote-access-controller.c b/src/backends/meta-remote-access-controller.c index 0e0ebe2bd..823da1a4b 100644 --- a/src/backends/meta-remote-access-controller.c +++ b/src/backends/meta-remote-access-controller.c @@ -87,8 +87,9 @@ meta_remote_access_handle_notify_stopped (MetaRemoteAccessHandle *handle) } void -meta_remote_access_controller_notify_new_handle (MetaRemoteAccessController *controller, - MetaRemoteAccessHandle *handle) +meta_remote_access_controller_notify_new_handle ( + MetaRemoteAccessController *controller, + MetaRemoteAccessHandle *handle) { g_signal_emit (controller, controller_signals[CONTROLLER_NEW_HANDLE], 0, handle); diff --git a/src/backends/meta-remote-desktop-session.c b/src/backends/meta-remote-desktop-session.c index 50c6f9a88..4f22d13d0 100644 --- a/src/backends/meta-remote-desktop-session.c +++ b/src/backends/meta-remote-desktop-session.c @@ -38,7 +38,8 @@ #include "meta-dbus-remote-desktop.h" -#define META_REMOTE_DESKTOP_SESSION_DBUS_PATH "/org/gnome/Mutter/RemoteDesktop/Session" +#define META_REMOTE_DESKTOP_SESSION_DBUS_PATH \ + "/org/gnome/Mutter/RemoteDesktop/Session" enum _MetaRemoteDesktopNotifyAxisFlags { @@ -65,7 +66,8 @@ struct _MetaRemoteDesktopSession }; static void -meta_remote_desktop_session_init_iface (MetaDBusRemoteDesktopSessionIface *iface); +meta_remote_desktop_session_init_iface ( + MetaDBusRemoteDesktopSessionIface *iface); static void meta_dbus_session_init_iface (MetaDbusSessionInterface *iface); @@ -73,8 +75,9 @@ meta_dbus_session_init_iface (MetaDbusSessionInterface *iface); G_DEFINE_TYPE_WITH_CODE (MetaRemoteDesktopSession, meta_remote_desktop_session, META_DBUS_TYPE_REMOTE_DESKTOP_SESSION_SKELETON, - G_IMPLEMENT_INTERFACE (META_DBUS_TYPE_REMOTE_DESKTOP_SESSION, - meta_remote_desktop_session_init_iface) + G_IMPLEMENT_INTERFACE ( + META_DBUS_TYPE_REMOTE_DESKTOP_SESSION, + meta_remote_desktop_session_init_iface) G_IMPLEMENT_INTERFACE (META_TYPE_DBUS_SESSION, meta_dbus_session_init_iface)) @@ -90,7 +93,7 @@ G_DEFINE_TYPE (MetaRemoteDesktopSessionHandle, META_TYPE_REMOTE_ACCESS_HANDLE) static MetaRemoteDesktopSessionHandle * -meta_remote_desktop_session_handle_new (MetaRemoteDesktopSession *session); +meta_remote_desktop_session_handle_new (MetaRemoteDesktopSession * session); static gboolean meta_remote_desktop_session_is_running (MetaRemoteDesktopSession *session) @@ -107,7 +110,8 @@ init_remote_access_handle (MetaRemoteDesktopSession *session) session->handle = meta_remote_desktop_session_handle_new (session); - remote_access_controller = meta_backend_get_remote_access_controller (backend); + remote_access_controller = + meta_backend_get_remote_access_controller (backend); remote_access_handle = META_REMOTE_ACCESS_HANDLE (session->handle); meta_remote_access_controller_notify_new_handle (remote_access_controller, remote_access_handle); @@ -197,9 +201,10 @@ on_screen_cast_session_closed (MetaScreenCastSession *screen_cast_session, } gboolean -meta_remote_desktop_session_register_screen_cast (MetaRemoteDesktopSession *session, - MetaScreenCastSession *screen_cast_session, - GError **error) +meta_remote_desktop_session_register_screen_cast ( + MetaRemoteDesktopSession *session, + MetaScreenCastSession *screen_cast_session, + GError **error) { if (session->screen_cast_session) { @@ -219,9 +224,9 @@ meta_remote_desktop_session_register_screen_cast (MetaRemoteDesktopSession *ses } MetaRemoteDesktopSession * -meta_remote_desktop_session_new (MetaRemoteDesktop *remote_desktop, - const char *peer_name, - GError **error) +meta_remote_desktop_session_new (MetaRemoteDesktop *remote_desktop, + const char *peer_name, + GError **error) { GDBusInterfaceSkeleton *interface_skeleton; MetaRemoteDesktopSession *session; @@ -452,11 +457,12 @@ handle_notify_pointer_axis (MetaDBusRemoteDesktopSession *skeleton, CLUTTER_SCROLL_FINISHED_VERTICAL); } - clutter_virtual_input_device_notify_scroll_continuous (session->virtual_pointer, - CLUTTER_CURRENT_TIME, - dx, dy, - CLUTTER_SCROLL_SOURCE_FINGER, - finish_flags); + clutter_virtual_input_device_notify_scroll_continuous ( + session->virtual_pointer, + CLUTTER_CURRENT_TIME, + dx, dy, + CLUTTER_SCROLL_SOURCE_FINGER, + finish_flags); meta_dbus_remote_desktop_session_complete_notify_pointer_axis (skeleton, invocation); @@ -522,13 +528,15 @@ handle_notify_pointer_axis_discrete (MetaDBusRemoteDesktopSession *skeleton, direction = discrete_steps_to_scroll_direction (axis, steps); for (step_count = 0; step_count < abs (steps); step_count++) - clutter_virtual_input_device_notify_discrete_scroll (session->virtual_pointer, - CLUTTER_CURRENT_TIME, - direction, - CLUTTER_SCROLL_SOURCE_WHEEL); + clutter_virtual_input_device_notify_discrete_scroll ( + session->virtual_pointer, + CLUTTER_CURRENT_TIME, + direction, + CLUTTER_SCROLL_SOURCE_WHEEL); - meta_dbus_remote_desktop_session_complete_notify_pointer_axis_discrete (skeleton, - invocation); + meta_dbus_remote_desktop_session_complete_notify_pointer_axis_discrete ( + skeleton, + invocation); return TRUE; } @@ -553,8 +561,9 @@ handle_notify_pointer_motion_relative (MetaDBusRemoteDesktopSession *skeleton, CLUTTER_CURRENT_TIME, dx, dy); - meta_dbus_remote_desktop_session_complete_notify_pointer_motion_relative (skeleton, - invocation); + meta_dbus_remote_desktop_session_complete_notify_pointer_motion_relative ( + skeleton, + invocation); return TRUE; } @@ -602,8 +611,9 @@ handle_notify_pointer_motion_absolute (MetaDBusRemoteDesktopSession *skeleton, CLUTTER_CURRENT_TIME, abs_x, abs_y); - meta_dbus_remote_desktop_session_complete_notify_pointer_motion_absolute (skeleton, - invocation); + meta_dbus_remote_desktop_session_complete_notify_pointer_motion_absolute ( + skeleton, + invocation); return TRUE; } @@ -699,10 +709,11 @@ handle_notify_touch_motion (MetaDBusRemoteDesktopSession *skeleton, meta_screen_cast_stream_transform_position (stream, x, y, &abs_x, &abs_y); - clutter_virtual_input_device_notify_touch_motion (session->virtual_touchscreen, - CLUTTER_CURRENT_TIME, - slot, - abs_x, abs_y); + clutter_virtual_input_device_notify_touch_motion ( + session->virtual_touchscreen, + CLUTTER_CURRENT_TIME, + slot, + abs_x, abs_y); meta_dbus_remote_desktop_session_complete_notify_touch_motion (skeleton, invocation); @@ -712,8 +723,8 @@ handle_notify_touch_motion (MetaDBusRemoteDesktopSession *skeleton, static gboolean handle_notify_touch_up (MetaDBusRemoteDesktopSession *skeleton, - GDBusMethodInvocation *invocation, - unsigned int slot) + GDBusMethodInvocation *invocation, + unsigned int slot) { MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton); @@ -726,8 +737,8 @@ handle_notify_touch_up (MetaDBusRemoteDesktopSession *skeleton, } clutter_virtual_input_device_notify_touch_up (session->virtual_touchscreen, - CLUTTER_CURRENT_TIME, - slot); + CLUTTER_CURRENT_TIME, + slot); meta_dbus_remote_desktop_session_complete_notify_touch_up (skeleton, invocation); @@ -744,9 +755,12 @@ meta_remote_desktop_session_init_iface (MetaDBusRemoteDesktopSessionIface *iface iface->handle_notify_keyboard_keysym = handle_notify_keyboard_keysym; iface->handle_notify_pointer_button = handle_notify_pointer_button; iface->handle_notify_pointer_axis = handle_notify_pointer_axis; - iface->handle_notify_pointer_axis_discrete = handle_notify_pointer_axis_discrete; - iface->handle_notify_pointer_motion_relative = handle_notify_pointer_motion_relative; - iface->handle_notify_pointer_motion_absolute = handle_notify_pointer_motion_absolute; + iface->handle_notify_pointer_axis_discrete = + handle_notify_pointer_axis_discrete; + iface->handle_notify_pointer_motion_relative = + handle_notify_pointer_motion_relative; + iface->handle_notify_pointer_motion_absolute = + handle_notify_pointer_motion_absolute; iface->handle_notify_touch_down = handle_notify_touch_down; iface->handle_notify_touch_motion = handle_notify_touch_motion; iface->handle_notify_touch_up = handle_notify_touch_up; @@ -783,7 +797,7 @@ static void meta_remote_desktop_session_init (MetaRemoteDesktopSession *session) { MetaDBusRemoteDesktopSession *skeleton = - META_DBUS_REMOTE_DESKTOP_SESSION (session); + META_DBUS_REMOTE_DESKTOP_SESSION (session); GRand *rand; static unsigned int global_session_number = 0; @@ -791,7 +805,8 @@ meta_remote_desktop_session_init (MetaRemoteDesktopSession *session) session->session_id = meta_generate_random_id (rand, 32); g_rand_free (rand); - meta_dbus_remote_desktop_session_set_session_id (skeleton, session->session_id); + meta_dbus_remote_desktop_session_set_session_id (skeleton, + session->session_id); session->object_path = g_strdup_printf (META_REMOTE_DESKTOP_SESSION_DBUS_PATH "/u%u", @@ -801,7 +816,6 @@ meta_remote_desktop_session_init (MetaRemoteDesktopSession *session) static void meta_remote_desktop_session_class_init (MetaRemoteDesktopSessionClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = meta_remote_desktop_session_finalize; @@ -836,7 +850,8 @@ meta_remote_desktop_session_handle_init (MetaRemoteDesktopSessionHandle *handle) } static void -meta_remote_desktop_session_handle_class_init (MetaRemoteDesktopSessionHandleClass *klass) +meta_remote_desktop_session_handle_class_init ( + MetaRemoteDesktopSessionHandleClass *klass) { MetaRemoteAccessHandleClass *remote_access_handle_class = META_REMOTE_ACCESS_HANDLE_CLASS (klass); diff --git a/src/backends/meta-renderer-view.c b/src/backends/meta-renderer-view.c index 19ab9efc8..4f3fef89c 100644 --- a/src/backends/meta-renderer-view.c +++ b/src/backends/meta-renderer-view.c @@ -46,7 +46,7 @@ G_DEFINE_TYPE (MetaRendererView, meta_renderer_view, CLUTTER_TYPE_STAGE_VIEW_COGL) MetaLogicalMonitor * -meta_renderer_view_get_logical_monitor (MetaRendererView *view) +meta_renderer_view_get_logical_monitor (MetaRendererView * view) { return view->logical_monitor; } @@ -113,14 +113,15 @@ meta_renderer_view_setup_offscreen_blit_pipeline (ClutterStageView *view, } static void -meta_renderer_view_set_transform (MetaRendererView *view, - MetaMonitorTransform transform) +meta_renderer_view_set_transform (MetaRendererView *view, + MetaMonitorTransform transform) { if (view->transform == transform) return; view->transform = transform; - clutter_stage_view_invalidate_offscreen_blit_pipeline (CLUTTER_STAGE_VIEW (view)); + clutter_stage_view_invalidate_offscreen_blit_pipeline (CLUTTER_STAGE_VIEW ( + view)); } static void diff --git a/src/backends/meta-renderer.c b/src/backends/meta-renderer.c index 191897e64..c1b033ad4 100644 --- a/src/backends/meta-renderer.c +++ b/src/backends/meta-renderer.c @@ -38,7 +38,7 @@ typedef struct _MetaRendererPrivate G_DEFINE_TYPE_WITH_PRIVATE (MetaRenderer, meta_renderer, G_TYPE_OBJECT) CoglRenderer * -meta_renderer_create_cogl_renderer (MetaRenderer *renderer) +meta_renderer_create_cogl_renderer (MetaRenderer * renderer) { return META_RENDERER_GET_CLASS (renderer)->create_cogl_renderer (renderer); } diff --git a/src/backends/meta-screen-cast-monitor-stream-src.c b/src/backends/meta-screen-cast-monitor-stream-src.c index 1118daadd..8957f005a 100644 --- a/src/backends/meta-screen-cast-monitor-stream-src.c +++ b/src/backends/meta-screen-cast-monitor-stream-src.c @@ -43,7 +43,7 @@ G_DEFINE_TYPE (MetaScreenCastMonitorStreamSrc, META_TYPE_SCREEN_CAST_STREAM_SRC) static ClutterStage * -get_stage (MetaScreenCastMonitorStreamSrc *monitor_src) +get_stage (MetaScreenCastMonitorStreamSrc * monitor_src) { MetaScreenCastStreamSrc *src; MetaScreenCastStream *stream; @@ -146,8 +146,9 @@ meta_screen_cast_monitor_stream_src_record_frame (MetaScreenCastStreamSrc *src, } MetaScreenCastMonitorStreamSrc * -meta_screen_cast_monitor_stream_src_new (MetaScreenCastMonitorStream *monitor_stream, - GError **error) +meta_screen_cast_monitor_stream_src_new ( + MetaScreenCastMonitorStream *monitor_stream, + GError **error) { return g_initable_new (META_TYPE_SCREEN_CAST_MONITOR_STREAM_SRC, NULL, error, "stream", monitor_stream, @@ -155,12 +156,14 @@ meta_screen_cast_monitor_stream_src_new (MetaScreenCastMonitorStream *monitor_s } static void -meta_screen_cast_monitor_stream_src_init (MetaScreenCastMonitorStreamSrc *monitor_src) +meta_screen_cast_monitor_stream_src_init ( + MetaScreenCastMonitorStreamSrc *monitor_src) { } static void -meta_screen_cast_monitor_stream_src_class_init (MetaScreenCastMonitorStreamSrcClass *klass) +meta_screen_cast_monitor_stream_src_class_init ( + MetaScreenCastMonitorStreamSrcClass *klass) { MetaScreenCastStreamSrcClass *src_class = META_SCREEN_CAST_STREAM_SRC_CLASS (klass); diff --git a/src/backends/meta-screen-cast-monitor-stream.c b/src/backends/meta-screen-cast-monitor-stream.c index df43f977c..3fa86ddbf 100644 --- a/src/backends/meta-screen-cast-monitor-stream.c +++ b/src/backends/meta-screen-cast-monitor-stream.c @@ -93,23 +93,25 @@ on_monitors_changed (MetaMonitorManager *monitor_manager, } ClutterStage * -meta_screen_cast_monitor_stream_get_stage (MetaScreenCastMonitorStream *monitor_stream) +meta_screen_cast_monitor_stream_get_stage ( + MetaScreenCastMonitorStream *monitor_stream) { return monitor_stream->stage; } MetaMonitor * -meta_screen_cast_monitor_stream_get_monitor (MetaScreenCastMonitorStream *monitor_stream) +meta_screen_cast_monitor_stream_get_monitor ( + MetaScreenCastMonitorStream *monitor_stream) { return monitor_stream->monitor; } MetaScreenCastMonitorStream * -meta_screen_cast_monitor_stream_new (GDBusConnection *connection, - MetaMonitorManager *monitor_manager, - MetaMonitor *monitor, - ClutterStage *stage, - GError **error) +meta_screen_cast_monitor_stream_new (GDBusConnection *connection, + MetaMonitorManager *monitor_manager, + MetaMonitor *monitor, + ClutterStage *stage, + GError **error) { MetaScreenCastMonitorStream *monitor_stream; @@ -138,8 +140,8 @@ meta_screen_cast_monitor_stream_new (GDBusConnection *connection, } static MetaScreenCastStreamSrc * -meta_screen_cast_monitor_stream_create_src (MetaScreenCastStream *stream, - GError **error) +meta_screen_cast_monitor_stream_create_src (MetaScreenCastStream *stream, + GError **error) { MetaScreenCastMonitorStream *monitor_stream = META_SCREEN_CAST_MONITOR_STREAM (stream); @@ -177,11 +179,12 @@ meta_screen_cast_monitor_stream_set_parameters (MetaScreenCastStream *stream, } static void -meta_screen_cast_monitor_stream_transform_position (MetaScreenCastStream *stream, - double stream_x, - double stream_y, - double *x, - double *y) +meta_screen_cast_monitor_stream_transform_position ( + MetaScreenCastStream *stream, + double stream_x, + double stream_y, + double *x, + double *y) { MetaScreenCastMonitorStream *monitor_stream = META_SCREEN_CAST_MONITOR_STREAM (stream); @@ -208,7 +211,8 @@ meta_screen_cast_monitor_stream_set_property (GObject *object, { case PROP_MONITOR: g_set_object (&monitor_stream->monitor, g_value_get_object (value)); - logical_monitor = meta_monitor_get_logical_monitor (monitor_stream->monitor); + logical_monitor = meta_monitor_get_logical_monitor ( + monitor_stream->monitor); g_set_object (&monitor_stream->logical_monitor, logical_monitor); break; default: @@ -244,16 +248,19 @@ meta_screen_cast_monitor_stream_finalize (GObject *object) g_clear_object (&monitor_stream->monitor); g_clear_object (&monitor_stream->logical_monitor); - G_OBJECT_CLASS (meta_screen_cast_monitor_stream_parent_class)->finalize (object); + G_OBJECT_CLASS (meta_screen_cast_monitor_stream_parent_class)->finalize ( + object); } static void -meta_screen_cast_monitor_stream_init (MetaScreenCastMonitorStream *monitor_stream) +meta_screen_cast_monitor_stream_init ( + MetaScreenCastMonitorStream *monitor_stream) { } static void -meta_screen_cast_monitor_stream_class_init (MetaScreenCastMonitorStreamClass *klass) +meta_screen_cast_monitor_stream_class_init ( + MetaScreenCastMonitorStreamClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); MetaScreenCastStreamClass *stream_class = @@ -265,7 +272,8 @@ meta_screen_cast_monitor_stream_class_init (MetaScreenCastMonitorStreamClass *kl stream_class->create_src = meta_screen_cast_monitor_stream_create_src; stream_class->set_parameters = meta_screen_cast_monitor_stream_set_parameters; - stream_class->transform_position = meta_screen_cast_monitor_stream_transform_position; + stream_class->transform_position = + meta_screen_cast_monitor_stream_transform_position; g_object_class_install_property (object_class, PROP_MONITOR, diff --git a/src/backends/meta-screen-cast-session.c b/src/backends/meta-screen-cast-session.c index e1b6393e8..89ea4e18a 100644 --- a/src/backends/meta-screen-cast-session.c +++ b/src/backends/meta-screen-cast-session.c @@ -30,7 +30,8 @@ #include "backends/meta-screen-cast-stream.h" #include "backends/meta-remote-access-controller-private.h" -#define META_SCREEN_CAST_SESSION_DBUS_PATH "/org/gnome/Mutter/ScreenCast/Session" +#define META_SCREEN_CAST_SESSION_DBUS_PATH \ + "/org/gnome/Mutter/ScreenCast/Session" struct _MetaScreenCastSession { @@ -55,8 +56,9 @@ meta_dbus_session_init_iface (MetaDbusSessionInterface *iface); G_DEFINE_TYPE_WITH_CODE (MetaScreenCastSession, meta_screen_cast_session, META_DBUS_TYPE_SCREEN_CAST_SESSION_SKELETON, - G_IMPLEMENT_INTERFACE (META_DBUS_TYPE_SCREEN_CAST_SESSION, - meta_screen_cast_session_init_iface) + G_IMPLEMENT_INTERFACE ( + META_DBUS_TYPE_SCREEN_CAST_SESSION, + meta_screen_cast_session_init_iface) G_IMPLEMENT_INTERFACE (META_TYPE_DBUS_SESSION, meta_dbus_session_init_iface)) @@ -72,7 +74,7 @@ G_DEFINE_TYPE (MetaScreenCastSessionHandle, META_TYPE_REMOTE_ACCESS_HANDLE) static MetaScreenCastSessionHandle * -meta_screen_cast_session_handle_new (MetaScreenCastSession *session); +meta_screen_cast_session_handle_new (MetaScreenCastSession * session); static void init_remote_access_handle (MetaScreenCastSession *session) @@ -83,15 +85,16 @@ init_remote_access_handle (MetaScreenCastSession *session) session->handle = meta_screen_cast_session_handle_new (session); - remote_access_controller = meta_backend_get_remote_access_controller (backend); + remote_access_controller = + meta_backend_get_remote_access_controller (backend); remote_access_handle = META_REMOTE_ACCESS_HANDLE (session->handle); meta_remote_access_controller_notify_new_handle (remote_access_controller, remote_access_handle); } gboolean -meta_screen_cast_session_start (MetaScreenCastSession *session, - GError **error) +meta_screen_cast_session_start (MetaScreenCastSession *session, + GError **error) { GList *l; @@ -370,10 +373,10 @@ meta_dbus_session_init_iface (MetaDbusSessionInterface *iface) } MetaScreenCastSession * -meta_screen_cast_session_new (MetaScreenCast *screen_cast, - MetaScreenCastSessionType session_type, - const char *peer_name, - GError **error) +meta_screen_cast_session_new (MetaScreenCast *screen_cast, + MetaScreenCastSessionType session_type, + const char *peer_name, + GError **error) { GDBusInterfaceSkeleton *interface_skeleton; MetaScreenCastSession *session; @@ -452,7 +455,8 @@ meta_screen_cast_session_handle_init (MetaScreenCastSessionHandle *handle) } static void -meta_screen_cast_session_handle_class_init (MetaScreenCastSessionHandleClass *klass) +meta_screen_cast_session_handle_class_init ( + MetaScreenCastSessionHandleClass *klass) { MetaRemoteAccessHandleClass *remote_access_handle_class = META_REMOTE_ACCESS_HANDLE_CLASS (klass); diff --git a/src/backends/meta-screen-cast-stream-src.c b/src/backends/meta-screen-cast-stream-src.c index 2d7a68e2a..506d5d115 100644 --- a/src/backends/meta-screen-cast-stream-src.c +++ b/src/backends/meta-screen-cast-stream-src.c @@ -38,7 +38,8 @@ #include "meta/boxes.h" #define PRIVATE_OWNER_FROM_FIELD(TypeName, field_ptr, field_name) \ - (TypeName *)((guint8 *)(field_ptr) - G_PRIVATE_OFFSET (TypeName, field_name)) + (TypeName *) ((guint8 *) (field_ptr) - \ + G_PRIVATE_OFFSET (TypeName, field_name)) enum { @@ -163,7 +164,8 @@ meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src) } else if (spa_buffer->datas[0].type == priv->pipewire_type->data.MemFd) { - map = mmap (NULL, spa_buffer->datas[0].maxsize + spa_buffer->datas[0].mapoffset, + map = mmap (NULL, + spa_buffer->datas[0].maxsize + spa_buffer->datas[0].mapoffset, PROT_READ | PROT_WRITE, MAP_SHARED, spa_buffer->datas[0].fd, 0); if (map == MAP_FAILED) @@ -230,10 +232,10 @@ meta_screen_cast_stream_src_notify_closed (MetaScreenCastStreamSrc *src) } static void -on_stream_state_changed (void *data, - enum pw_stream_state old, - enum pw_stream_state state, - const char *error_message) +on_stream_state_changed (void *data, + enum pw_stream_state old, + enum pw_stream_state state, + const char *error_message) { MetaScreenCastStreamSrc *src = data; MetaScreenCastStreamSrcPrivate *priv = @@ -307,15 +309,16 @@ on_stream_format_changed (void *data, params, G_N_ELEMENTS (params)); } -static const struct pw_stream_events stream_events = { +static const struct pw_stream_events stream_events = +{ PW_VERSION_STREAM_EVENTS, .state_changed = on_stream_state_changed, .format_changed = on_stream_format_changed, }; static struct pw_stream * -create_pipewire_stream (MetaScreenCastStreamSrc *src, - GError **error) +create_pipewire_stream (MetaScreenCastStreamSrc *src, + GError **error) { MetaScreenCastStreamSrcPrivate *priv = meta_screen_cast_stream_src_get_instance_private (src); @@ -360,8 +363,8 @@ create_pipewire_stream (MetaScreenCastStreamSrc *src, ":", spa_type->format_video.size, "R", &SPA_RECTANGLE (width, height), ":", spa_type->format_video.framerate, "F", &SPA_FRACTION (0, 1), ":", spa_type->format_video.max_framerate, "Fru", &max_framerate, - PROP_RANGE (&min_framerate, - &max_framerate)); + PROP_RANGE (&min_framerate, + &max_framerate)); pw_stream_add_listener (pipewire_stream, &priv->pipewire_stream_listener, @@ -385,10 +388,10 @@ create_pipewire_stream (MetaScreenCastStreamSrc *src, } static void -on_state_changed (void *data, - enum pw_remote_state old, - enum pw_remote_state state, - const char *error_message) +on_state_changed (void *data, + enum pw_remote_state old, + enum pw_remote_state state, + const char *error_message) { MetaScreenCastStreamSrc *src = data; MetaScreenCastStreamSrcPrivate *priv = @@ -430,9 +433,9 @@ pipewire_loop_source_prepare (GSource *base, } static gboolean -pipewire_loop_source_dispatch (GSource *source, - GSourceFunc callback, - gpointer user_data) +pipewire_loop_source_dispatch (GSource *source, + GSourceFunc callback, + gpointer user_data) { MetaPipeWireSource *pipewire_source = (MetaPipeWireSource *) source; int result; @@ -496,15 +499,16 @@ create_pipewire_source (void) return pipewire_source; } -static const struct pw_remote_events remote_events = { +static const struct pw_remote_events remote_events = +{ PW_VERSION_REMOTE_EVENTS, .state_changed = on_state_changed, }; static gboolean -meta_screen_cast_stream_src_initable_init (GInitable *initable, - GCancellable *cancellable, - GError **error) +meta_screen_cast_stream_src_initable_init (GInitable *initable, + GCancellable *cancellable, + GError **error) { MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (initable); MetaScreenCastStreamSrcPrivate *priv = @@ -600,7 +604,7 @@ meta_screen_cast_stream_src_set_property (GObject *object, { case PROP_STREAM: priv->stream = g_value_get_object (value); - break;; + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } diff --git a/src/backends/meta-screen-cast-stream.c b/src/backends/meta-screen-cast-stream.c index 97ee4bfcf..496fcc3c1 100644 --- a/src/backends/meta-screen-cast-stream.c +++ b/src/backends/meta-screen-cast-stream.c @@ -61,8 +61,8 @@ G_DEFINE_TYPE_WITH_CODE (MetaScreenCastStream, G_ADD_PRIVATE (MetaScreenCastStream)) static MetaScreenCastStreamSrc * -meta_screen_cast_stream_create_src (MetaScreenCastStream *stream, - GError **error) +meta_screen_cast_stream_create_src (MetaScreenCastStream * stream, + GError * *error) { return META_SCREEN_CAST_STREAM_GET_CLASS (stream)->create_src (stream, error); @@ -98,8 +98,8 @@ on_stream_src_ready (MetaScreenCastStreamSrc *src, } gboolean -meta_screen_cast_stream_start (MetaScreenCastStream *stream, - GError **error) +meta_screen_cast_stream_start (MetaScreenCastStream *stream, + GError **error) { MetaScreenCastStreamPrivate *priv = meta_screen_cast_stream_get_instance_private (stream); @@ -206,9 +206,9 @@ meta_screen_cast_stream_finalize (GObject *object) } static gboolean -meta_screen_cast_stream_initable_init (GInitable *initable, - GCancellable *cancellable, - GError **error) +meta_screen_cast_stream_initable_init (GInitable *initable, + GCancellable *cancellable, + GError **error) { MetaScreenCastStream *stream = META_SCREEN_CAST_STREAM (initable); MetaDBusScreenCastStream *skeleton = META_DBUS_SCREEN_CAST_STREAM (stream); diff --git a/src/backends/meta-screen-cast.c b/src/backends/meta-screen-cast.c index bebef5b4e..411638e8b 100644 --- a/src/backends/meta-screen-cast.c +++ b/src/backends/meta-screen-cast.c @@ -54,7 +54,7 @@ G_DEFINE_TYPE_WITH_CODE (MetaScreenCast, meta_screen_cast, meta_screen_cast_init_iface)) GDBusConnection * -meta_screen_cast_get_connection (MetaScreenCast *screen_cast) +meta_screen_cast_get_connection (MetaScreenCast * screen_cast) { GDBusInterfaceSkeleton *interface_skeleton = G_DBUS_INTERFACE_SKELETON (screen_cast); @@ -63,9 +63,9 @@ meta_screen_cast_get_connection (MetaScreenCast *screen_cast) } static gboolean -register_remote_desktop_screen_cast_session (MetaScreenCastSession *session, - const char *remote_desktop_session_id, - GError **error) +register_remote_desktop_screen_cast_session (MetaScreenCastSession *session, + const char *remote_desktop_session_id, + GError **error) { MetaBackend *backend = meta_get_backend (); MetaRemoteDesktop *remote_desktop = meta_backend_get_remote_desktop (backend); diff --git a/src/backends/meta-settings.c b/src/backends/meta-settings.c index 34d49b3ed..696b91f01 100644 --- a/src/backends/meta-settings.c +++ b/src/backends/meta-settings.c @@ -381,7 +381,6 @@ wayland_settings_changed (GSettings *wayland_settings, gchar *key, MetaSettings *settings) { - if (g_str_equal (key, "xwayland-allow-grabs")) { update_xwayland_allow_grabs (settings); @@ -393,16 +392,16 @@ wayland_settings_changed (GSettings *wayland_settings, } void -meta_settings_get_xwayland_grab_patterns (MetaSettings *settings, - GPtrArray **whitelist_patterns, - GPtrArray **blacklist_patterns) +meta_settings_get_xwayland_grab_patterns (MetaSettings *settings, + GPtrArray **whitelist_patterns, + GPtrArray **blacklist_patterns) { *whitelist_patterns = settings->xwayland_grab_whitelist_patterns; *blacklist_patterns = settings->xwayland_grab_blacklist_patterns; } gboolean - meta_settings_are_xwayland_grabs_allowed (MetaSettings *settings) +meta_settings_are_xwayland_grabs_allowed (MetaSettings *settings) { return (settings->xwayland_allow_grabs); } diff --git a/src/backends/meta-stage.c b/src/backends/meta-stage.c index 9b1dadab7..058df5fee 100644 --- a/src/backends/meta-stage.c +++ b/src/backends/meta-stage.c @@ -30,7 +30,8 @@ #include "meta/meta-monitor-manager.h" #include "meta/util.h" -struct _MetaOverlay { +struct _MetaOverlay +{ gboolean enabled; CoglPipeline *pipeline; @@ -55,7 +56,8 @@ static MetaOverlay * meta_overlay_new (void) { MetaOverlay *overlay; - CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ()); + CoglContext *ctx = clutter_backend_get_cogl_context ( + clutter_get_default_backend ()); overlay = g_slice_new0 (MetaOverlay); overlay->pipeline = cogl_pipeline_new (ctx); diff --git a/src/backends/native/dbus-utils.c b/src/backends/native/dbus-utils.c index 79fafe881..eb0845bcf 100644 --- a/src/backends/native/dbus-utils.c +++ b/src/backends/native/dbus-utils.c @@ -82,7 +82,7 @@ escape_dbus_component (const gchar *name) g_string_append_len (op, first_ok, ptr - first_ok); } /* escape the unsafe character */ - g_string_append_printf (op, "_%02x", (unsigned char)(*ptr)); + g_string_append_printf (op, "_%02x", (unsigned char) (*ptr)); /* restart after it */ first_ok = ptr + 1; } diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c index b8ea93da9..77652574e 100644 --- a/src/backends/native/meta-backend-native.c +++ b/src/backends/native/meta-backend-native.c @@ -64,7 +64,8 @@ static GInitableIface *initable_parent_iface; static void initable_iface_init (GInitableIface *initable_iface); -G_DEFINE_TYPE_WITH_CODE (MetaBackendNative, meta_backend_native, META_TYPE_BACKEND, +G_DEFINE_TYPE_WITH_CODE (MetaBackendNative, meta_backend_native, + META_TYPE_BACKEND, G_ADD_PRIVATE (MetaBackendNative) G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init)) @@ -73,7 +74,8 @@ static void meta_backend_native_finalize (GObject *object) { MetaBackendNative *native = META_BACKEND_NATIVE (object); - MetaBackendNativePrivate *priv = meta_backend_native_get_instance_private (native); + MetaBackendNativePrivate *priv = meta_backend_native_get_instance_private ( + native); meta_launcher_free (priv->launcher); @@ -216,24 +218,40 @@ relative_motion_across_outputs (MetaMonitorManager *monitor_manager, MetaVector2 intersection; motion = (MetaLine2) { - .a = { x, y }, - .b = { x + (dx * cur->scale), y + (dy * cur->scale) } + .a = { x, y }, + .b = { x + (dx * cur->scale), y + (dy * cur->scale) } }; left = (MetaLine2) { - { cur->rect.x, cur->rect.y }, - { cur->rect.x, cur->rect.y + cur->rect.height } + { + cur->rect.x, cur->rect.y + }, + { + cur->rect.x, cur->rect.y + cur->rect.height + } }; right = (MetaLine2) { - { cur->rect.x + cur->rect.width, cur->rect.y }, - { cur->rect.x + cur->rect.width, cur->rect.y + cur->rect.height } + { + cur->rect.x + cur->rect.width, cur->rect.y + }, + { + cur->rect.x + cur->rect.width, cur->rect.y + cur->rect.height + } }; top = (MetaLine2) { - { cur->rect.x, cur->rect.y }, - { cur->rect.x + cur->rect.width, cur->rect.y } + { + cur->rect.x, cur->rect.y + }, + { + cur->rect.x + cur->rect.width, cur->rect.y + } }; bottom = (MetaLine2) { - { cur->rect.x, cur->rect.y + cur->rect.height }, - { cur->rect.x + cur->rect.width, cur->rect.y + cur->rect.height } + { + cur->rect.x, cur->rect.y + cur->rect.height + }, + { + cur->rect.x + cur->rect.width, cur->rect.y + cur->rect.height + } }; if (direction != META_DISPLAY_RIGHT && @@ -284,17 +302,20 @@ relative_motion_filter (ClutterInputDevice *device, if (meta_is_stage_views_scaled ()) return; - logical_monitor = meta_monitor_manager_get_logical_monitor_at (monitor_manager, - x, y); + logical_monitor = meta_monitor_manager_get_logical_monitor_at ( + monitor_manager, + x, y); if (!logical_monitor) return; new_dx = (*dx) * logical_monitor->scale; new_dy = (*dy) * logical_monitor->scale; - dest_logical_monitor = meta_monitor_manager_get_logical_monitor_at (monitor_manager, - x + new_dx, - y + new_dy); + dest_logical_monitor = meta_monitor_manager_get_logical_monitor_at ( + monitor_manager, + x + new_dx, + y + + new_dy); if (dest_logical_monitor && dest_logical_monitor != logical_monitor) { @@ -324,10 +345,12 @@ meta_backend_native_post_init (MetaBackend *backend) META_BACKEND_CLASS (meta_backend_native_parent_class)->post_init (backend); - clutter_evdev_set_pointer_constrain_callback (manager, pointer_constrain_callback, + clutter_evdev_set_pointer_constrain_callback (manager, + pointer_constrain_callback, NULL, NULL); clutter_evdev_set_relative_motion_filter (manager, relative_motion_filter, - meta_backend_get_monitor_manager (backend)); + meta_backend_get_monitor_manager ( + backend)); } static MetaMonitorManager * @@ -374,7 +397,8 @@ meta_backend_native_warp_pointer (MetaBackend *backend, int y) { ClutterDeviceManager *manager = clutter_device_manager_get_default (); - ClutterInputDevice *device = clutter_device_manager_get_core_device (manager, CLUTTER_POINTER_DEVICE); + ClutterInputDevice *device = clutter_device_manager_get_core_device (manager, + CLUTTER_POINTER_DEVICE); MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend); /* XXX */ @@ -417,7 +441,8 @@ meta_backend_native_set_keymap (MetaBackend *backend, names.options = options; context = xkb_context_new (XKB_CONTEXT_NO_FLAGS); - keymap = xkb_keymap_new_from_names (context, &names, XKB_KEYMAP_COMPILE_NO_FLAGS); + keymap = xkb_keymap_new_from_names (context, &names, + XKB_KEYMAP_COMPILE_NO_FLAGS); xkb_context_unref (context); clutter_evdev_set_keyboard_map (manager, keymap); @@ -466,12 +491,12 @@ meta_backend_native_set_numlock (MetaBackend *backend, } static gboolean -meta_backend_native_get_relative_motion_deltas (MetaBackend *backend, - const ClutterEvent *event, - double *dx, - double *dy, - double *dx_unaccel, - double *dy_unaccel) +meta_backend_native_get_relative_motion_deltas (MetaBackend *backend, + const ClutterEvent *event, + double *dx, + double *dy, + double *dx_unaccel, + double *dy_unaccel) { return clutter_evdev_event_get_relative_motion (event, dx, dy, @@ -493,9 +518,9 @@ meta_backend_native_update_screen_size (MetaBackend *backend, } static gboolean -meta_backend_native_initable_init (GInitable *initable, - GCancellable *cancellable, - GError **error) +meta_backend_native_initable_init (GInitable *initable, + GCancellable *cancellable, + GError **error) { if (!meta_is_stage_views_enabled ()) { @@ -523,24 +548,31 @@ meta_backend_native_class_init (MetaBackendNativeClass *klass) object_class->finalize = meta_backend_native_finalize; - backend_class->create_clutter_backend = meta_backend_native_create_clutter_backend; + backend_class->create_clutter_backend = + meta_backend_native_create_clutter_backend; backend_class->post_init = meta_backend_native_post_init; - backend_class->create_monitor_manager = meta_backend_native_create_monitor_manager; - backend_class->create_cursor_renderer = meta_backend_native_create_cursor_renderer; + backend_class->create_monitor_manager = + meta_backend_native_create_monitor_manager; + backend_class->create_cursor_renderer = + meta_backend_native_create_cursor_renderer; backend_class->create_renderer = meta_backend_native_create_renderer; - backend_class->create_input_settings = meta_backend_native_create_input_settings; + backend_class->create_input_settings = + meta_backend_native_create_input_settings; backend_class->warp_pointer = meta_backend_native_warp_pointer; - backend_class->get_current_logical_monitor = meta_backend_native_get_current_logical_monitor; + backend_class->get_current_logical_monitor = + meta_backend_native_get_current_logical_monitor; backend_class->set_keymap = meta_backend_native_set_keymap; backend_class->get_keymap = meta_backend_native_get_keymap; - backend_class->get_keymap_layout_group = meta_backend_native_get_keymap_layout_group; + backend_class->get_keymap_layout_group = + meta_backend_native_get_keymap_layout_group; backend_class->lock_layout_group = meta_backend_native_lock_layout_group; - backend_class->get_relative_motion_deltas = meta_backend_native_get_relative_motion_deltas; + backend_class->get_relative_motion_deltas = + meta_backend_native_get_relative_motion_deltas; backend_class->update_screen_size = meta_backend_native_update_screen_size; backend_class->set_numlock = meta_backend_native_set_numlock; } @@ -548,7 +580,8 @@ meta_backend_native_class_init (MetaBackendNativeClass *klass) static void meta_backend_native_init (MetaBackendNative *native) { - MetaBackendNativePrivate *priv = meta_backend_native_get_instance_private (native); + MetaBackendNativePrivate *priv = meta_backend_native_get_instance_private ( + native); GError *error = NULL; priv->launcher = meta_launcher_new (&error); @@ -607,7 +640,8 @@ meta_activate_session (void) return TRUE; MetaBackendNative *native = META_BACKEND_NATIVE (backend); - MetaBackendNativePrivate *priv = meta_backend_native_get_instance_private (native); + MetaBackendNativePrivate *priv = meta_backend_native_get_instance_private ( + native); if (!meta_launcher_activate_session (priv->launcher, &error)) { diff --git a/src/backends/native/meta-barrier-native.c b/src/backends/native/meta-barrier-native.c index d335cbc17..2ead67b4e 100644 --- a/src/backends/native/meta-barrier-native.c +++ b/src/backends/native/meta-barrier-native.c @@ -46,7 +46,8 @@ struct _MetaBarrierManagerNative GHashTable *barriers; }; -typedef enum { +typedef enum +{ /* The barrier is active and responsive to pointer motion. */ META_BARRIER_STATE_ACTIVE, @@ -67,14 +68,14 @@ typedef enum { struct _MetaBarrierImplNativePrivate { - MetaBarrier *barrier; + MetaBarrier *barrier; MetaBarrierManagerNative *manager; - gboolean is_active; - MetaBarrierState state; - int trigger_serial; - guint32 last_event_time; - MetaBarrierDirection blocked_dir; + gboolean is_active; + MetaBarrierState state; + int trigger_serial; + guint32 last_event_time; + MetaBarrierDirection blocked_dir; }; G_DEFINE_TYPE_WITH_PRIVATE (MetaBarrierImplNative, meta_barrier_impl_native, @@ -213,12 +214,15 @@ maybe_release_barriers (MetaBarrierManagerNative *manager, float x, float y) { - MetaLine2 motion = { - .a = { + MetaLine2 motion = + { + .a = + { .x = prev_x, .y = prev_y, }, - .b = { + .b = + { .x = x, .y = y, }, @@ -233,14 +237,14 @@ typedef struct _MetaClosestBarrierData { struct { - MetaLine2 motion; - MetaBarrierDirection directions; + MetaLine2 motion; + MetaBarrierDirection directions; } in; struct { - float closest_distance_2; - MetaBarrierImplNative *barrier_impl; + float closest_distance_2; + MetaBarrierImplNative *barrier_impl; } out; } MetaClosestBarrierData; @@ -282,7 +286,7 @@ update_closest_barrier (gpointer key, * barrier. */ dx = intersection.x - data->in.motion.a.x; dy = intersection.y - data->in.motion.a.y; - distance_2 = dx*dx + dy*dy; + distance_2 = dx * dx + dy * dy; if (data->out.barrier_impl == NULL || distance_2 < data->out.closest_distance_2) { @@ -303,13 +307,17 @@ get_closest_barrier (MetaBarrierManagerNative *manager, MetaClosestBarrierData closest_barrier_data; closest_barrier_data = (MetaClosestBarrierData) { - .in = { - .motion = { - .a = { + .in = + { + .motion = + { + .a = + { .x = prev_x, .y = prev_y, }, - .b = { + .b = + { .x = x, .y = y, }, @@ -335,13 +343,13 @@ get_closest_barrier (MetaBarrierManagerNative *manager, typedef struct _MetaBarrierEventData { - guint32 time; - float prev_x; - float prev_y; - float x; - float y; - float dx; - float dy; + guint32 time; + float prev_x; + float prev_y; + float x; + float y; + float dx; + float dy; } MetaBarrierEventData; static void @@ -372,7 +380,7 @@ emit_barrier_event (MetaBarrierImplNative *self, case META_BARRIER_STATE_LEFT: priv->state = META_BARRIER_STATE_ACTIVE; - /* Intentional fall-through. */ + /* Intentional fall-through. */ case META_BARRIER_STATE_HELD: event->dt = time - priv->last_event_time; @@ -411,7 +419,8 @@ maybe_emit_barrier_event (gpointer key, gpointer value, gpointer user_data) meta_barrier_impl_native_get_instance_private (self); MetaBarrierEventData *data = user_data; - switch (priv->state) { + switch (priv->state) + { case META_BARRIER_STATE_ACTIVE: break; case META_BARRIER_STATE_HIT: @@ -433,9 +442,9 @@ maybe_emit_barrier_event (gpointer key, gpointer value, gpointer user_data) /* Clamp (x, y) to the barrier and remove clamped direction from motion_dir. */ static void clamp_to_barrier (MetaBarrierImplNative *self, - MetaBarrierDirection *motion_dir, - float *x, - float *y) + MetaBarrierDirection *motion_dir, + float *x, + float *y) { MetaBarrierImplNativePrivate *priv = meta_barrier_impl_native_get_instance_private (self); diff --git a/src/backends/native/meta-clutter-backend-native.c b/src/backends/native/meta-clutter-backend-native.c index be86eb50e..bfd972200 100644 --- a/src/backends/native/meta-clutter-backend-native.c +++ b/src/backends/native/meta-clutter-backend-native.c @@ -46,7 +46,7 @@ G_DEFINE_TYPE (MetaClutterBackendNative, meta_clutter_backend_native, CLUTTER_TYPE_BACKEND_EGL_NATIVE) MetaStageNative * -meta_clutter_backend_native_get_stage_native (ClutterBackend *backend) +meta_clutter_backend_native_get_stage_native (ClutterBackend * backend) { MetaClutterBackendNative *clutter_backend_native = META_CLUTTER_BACKEND_NATIVE (backend); @@ -55,8 +55,8 @@ meta_clutter_backend_native_get_stage_native (ClutterBackend *backend) } static CoglRenderer * -meta_clutter_backend_native_get_renderer (ClutterBackend *clutter_backend, - GError **error) +meta_clutter_backend_native_get_renderer (ClutterBackend *clutter_backend, + GError **error) { MetaBackend *backend = meta_get_backend (); MetaRenderer *renderer = meta_backend_get_renderer (backend); @@ -65,9 +65,9 @@ meta_clutter_backend_native_get_renderer (ClutterBackend *clutter_backend, } static ClutterStageWindow * -meta_clutter_backend_native_create_stage (ClutterBackend *backend, - ClutterStage *wrapper, - GError **error) +meta_clutter_backend_native_create_stage (ClutterBackend *backend, + ClutterStage *wrapper, + GError **error) { MetaClutterBackendNative *clutter_backend_native = META_CLUTTER_BACKEND_NATIVE (backend); @@ -82,7 +82,7 @@ meta_clutter_backend_native_create_stage (ClutterBackend *backend, } static void -meta_clutter_backend_native_bell_notify (ClutterBackend *backend) +meta_clutter_backend_native_bell_notify (ClutterBackend *backend) { MetaDisplay *display = meta_get_display (); @@ -90,7 +90,8 @@ meta_clutter_backend_native_bell_notify (ClutterBackend *backend) } static void -meta_clutter_backend_native_init (MetaClutterBackendNative *clutter_backend_nativen) +meta_clutter_backend_native_init ( + MetaClutterBackendNative *clutter_backend_nativen) { } @@ -99,7 +100,9 @@ meta_clutter_backend_native_class_init (MetaClutterBackendNativeClass *klass) { ClutterBackendClass *clutter_backend_class = CLUTTER_BACKEND_CLASS (klass); - clutter_backend_class->get_renderer = meta_clutter_backend_native_get_renderer; - clutter_backend_class->create_stage = meta_clutter_backend_native_create_stage; + clutter_backend_class->get_renderer = + meta_clutter_backend_native_get_renderer; + clutter_backend_class->create_stage = + meta_clutter_backend_native_create_stage; clutter_backend_class->bell_notify = meta_clutter_backend_native_bell_notify; } diff --git a/src/backends/native/meta-crtc-kms.c b/src/backends/native/meta-crtc-kms.c index 523ea6ccc..2148e6e7d 100644 --- a/src/backends/native/meta-crtc-kms.c +++ b/src/backends/native/meta-crtc-kms.c @@ -48,8 +48,8 @@ typedef struct _MetaCrtcKms } MetaCrtcKms; gboolean -meta_crtc_kms_is_transform_handled (MetaCrtc *crtc, - MetaMonitorTransform transform) +meta_crtc_kms_is_transform_handled (MetaCrtc *crtc, + MetaMonitorTransform transform) { MetaCrtcKms *crtc_kms = crtc->driver_private; @@ -132,7 +132,6 @@ meta_crtc_kms_set_underscan (MetaCrtc *crtc, DRM_MODE_OBJECT_CRTC, crtc_kms->underscan_vborder_prop_id, value); } - } else { @@ -143,10 +142,10 @@ meta_crtc_kms_set_underscan (MetaCrtc *crtc, } static int -find_property_index (MetaGpu *gpu, - drmModeObjectPropertiesPtr props, - const char *prop_name, - drmModePropertyPtr *out_prop) +find_property_index (MetaGpu *gpu, + drmModeObjectPropertiesPtr props, + const char *prop_name, + drmModePropertyPtr *out_prop) { MetaGpuKms *gpu_kms = META_GPU_KMS (gpu); int kms_fd; @@ -429,9 +428,9 @@ meta_crtc_destroy_notify (MetaCrtc *crtc) } MetaCrtc * -meta_create_kms_crtc (MetaGpuKms *gpu_kms, - drmModeCrtc *drm_crtc, - unsigned int crtc_index) +meta_create_kms_crtc (MetaGpuKms *gpu_kms, + drmModeCrtc *drm_crtc, + unsigned int crtc_index) { MetaGpu *gpu = META_GPU (gpu_kms); MetaCrtc *crtc; @@ -448,7 +447,7 @@ meta_create_kms_crtc (MetaGpuKms *gpu_kms, crtc->is_dirty = FALSE; crtc->transform = META_MONITOR_TRANSFORM_NORMAL; crtc->all_transforms = meta_is_stage_views_enabled () ? - ALL_TRANSFORMS_MASK : META_MONITOR_TRANSFORM_NORMAL; + ALL_TRANSFORMS_MASK : META_MONITOR_TRANSFORM_NORMAL; if (drm_crtc->mode_valid) { diff --git a/src/backends/native/meta-cursor-renderer-native.c b/src/backends/native/meta-cursor-renderer-native.c index cb39bbed3..4790571d7 100644 --- a/src/backends/native/meta-cursor-renderer-native.c +++ b/src/backends/native/meta-cursor-renderer-native.c @@ -116,7 +116,9 @@ typedef struct _MetaCursorNativePrivate static GQuark quark_cursor_renderer_native_gpu_data = 0; -G_DEFINE_TYPE_WITH_PRIVATE (MetaCursorRendererNative, meta_cursor_renderer_native, META_TYPE_CURSOR_RENDERER); +G_DEFINE_TYPE_WITH_PRIVATE (MetaCursorRendererNative, + meta_cursor_renderer_native, + META_TYPE_CURSOR_RENDERER); static void realize_cursor_sprite (MetaCursorRenderer *renderer, @@ -172,7 +174,8 @@ meta_cursor_renderer_native_finalize (GObject *object) } static guint -get_pending_cursor_sprite_gbm_bo_index (MetaCursorNativeGpuState *cursor_gpu_state) +get_pending_cursor_sprite_gbm_bo_index ( + MetaCursorNativeGpuState *cursor_gpu_state) { return (cursor_gpu_state->active_bo + 1) % HW_CURSOR_BUFFER_COUNT; } @@ -333,11 +336,13 @@ update_monitor_crtc_cursor (MetaMonitor *monitor, } scaled_crtc_rect = (ClutterRect) { - .origin = { + .origin = + { .x = crtc_x / scale, .y = crtc_y / scale }, - .size = { + .size = + { .width = crtc_width / scale, .height = crtc_height / scale }, @@ -395,7 +400,9 @@ update_hw_cursor (MetaCursorRendererNative *native, if (cursor_sprite) rect = meta_cursor_renderer_calculate_rect (renderer, cursor_sprite); else - rect = (ClutterRect) { 0 }; + rect = (ClutterRect) { + 0 + }; logical_monitors = meta_monitor_manager_get_logical_monitors (monitor_manager); @@ -410,7 +417,8 @@ update_hw_cursor (MetaCursorRendererNative *native, .in_cursor_renderer_native = native, .in_logical_monitor = logical_monitor, .in_local_cursor_rect = (ClutterRect) { - .origin = { + .origin = + { .x = rect.origin.x - logical_monitor->rect.x, .y = rect.origin.y - logical_monitor->rect.y }, @@ -512,7 +520,8 @@ cursor_over_transformed_logical_monitor (MetaCursorRenderer *renderer, transform = meta_logical_monitor_get_transform (logical_monitor); /* Get transform corrected for LCD panel-orientation. */ - transform = meta_monitor_logical_to_crtc_transform (monitor, transform); + transform = + meta_monitor_logical_to_crtc_transform (monitor, transform); if (transform != META_MONITOR_TRANSFORM_NORMAL) return TRUE; } @@ -544,7 +553,7 @@ can_draw_cursor_unscaled (MetaCursorRenderer *renderer, gboolean has_visible_crtc_sprite = FALSE; if (!meta_is_stage_views_scaled ()) - return meta_cursor_sprite_get_texture_scale (cursor_sprite) == 1.0; + return meta_cursor_sprite_get_texture_scale (cursor_sprite) == 1.0; logical_monitors = meta_monitor_manager_get_logical_monitors (monitor_manager); @@ -856,7 +865,7 @@ load_cursor_sprite_gbm_buffer_for_gpu (MetaCursorRendererNative *native, if (width > cursor_width || height > cursor_height) { meta_warning ("Invalid theme cursor size (must be at most %ux%u)\n", - (unsigned int)cursor_width, (unsigned int)cursor_height); + (unsigned int) cursor_width, (unsigned int) cursor_height); return; } @@ -876,7 +885,7 @@ load_cursor_sprite_gbm_buffer_for_gpu (MetaCursorRendererNative *native, return; } - memset (buf, 0, sizeof(buf)); + memset (buf, 0, sizeof (buf)); for (i = 0; i < height; i++) memcpy (buf + i * 4 * cursor_width, pixels + i * rowstride, width * 4); if (gbm_bo_write (bo, buf, cursor_width * cursor_height * 4) != 0) @@ -1015,7 +1024,8 @@ realize_cursor_sprite_from_wl_buffer_for_gpu (MetaCursorRenderer *renderer, if (width != cursor_width || height != cursor_height) { - meta_warning ("Invalid cursor size (must be 64x64), falling back to software (GL) cursors\n"); + meta_warning ( + "Invalid cursor size (must be 64x64), falling back to software (GL) cursors\n"); return; } diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c index 57582f699..b4e05f12f 100644 --- a/src/backends/native/meta-gpu-kms.c +++ b/src/backends/native/meta-gpu-kms.c @@ -85,9 +85,9 @@ kms_event_check (GSource *source) } static gboolean -kms_event_dispatch (GSource *source, - GSourceFunc callback, - gpointer user_data) +kms_event_dispatch (GSource *source, + GSourceFunc callback, + gpointer user_data) { MetaKmsSource *kms_source = (MetaKmsSource *) source; @@ -96,17 +96,18 @@ kms_event_dispatch (GSource *source, return G_SOURCE_CONTINUE; } -static GSourceFuncs kms_event_funcs = { +static GSourceFuncs kms_event_funcs = +{ NULL, kms_event_check, kms_event_dispatch }; static void -get_crtc_drm_connectors (MetaGpu *gpu, - MetaCrtc *crtc, - uint32_t **connectors, - unsigned int *n_connectors) +get_crtc_drm_connectors (MetaGpu *gpu, + MetaCrtc *crtc, + uint32_t **connectors, + unsigned int *n_connectors) { GArray *connectors_array = g_array_new (FALSE, FALSE, sizeof (uint32_t)); GList *l; @@ -169,7 +170,8 @@ static void invoke_flip_closure (GClosure *flip_closure, MetaGpuKms *gpu_kms) { - GValue params[] = { + GValue params[] = + { G_VALUE_INIT, G_VALUE_INIT }; @@ -232,7 +234,8 @@ meta_gpu_kms_wrap_flip_closure (MetaGpuKms *gpu_kms, } void -meta_gpu_kms_flip_closure_container_free (MetaGpuKmsFlipClosureContainer *closure_container) +meta_gpu_kms_flip_closure_container_free ( + MetaGpuKmsFlipClosureContainer *closure_container) { g_free (closure_container); } @@ -301,11 +304,11 @@ meta_gpu_kms_flip_crtc (MetaGpuKms *gpu_kms, } static void -page_flip_handler (int fd, - unsigned int frame, - unsigned int sec, - unsigned int usec, - void *user_data) +page_flip_handler (int fd, + unsigned int frame, + unsigned int sec, + unsigned int usec, + void *user_data) { MetaGpuKmsFlipClosureContainer *closure_container = user_data; GClosure *flip_closure = closure_container->flip_closure; @@ -601,7 +604,8 @@ init_modes (MetaGpuKms *gpu_kms, /* * Gather all modes on all connected connectors. */ - modes_table = g_hash_table_new (drm_mode_hash, (GEqualFunc) meta_drm_mode_equal); + modes_table = g_hash_table_new (drm_mode_hash, + (GEqualFunc) meta_drm_mode_equal); for (i = 0; i < gpu_kms->n_connectors; i++) { drmModeConnector *drm_connector; @@ -733,9 +737,9 @@ init_outputs (MetaGpuKms *gpu_kms, } static gboolean -meta_kms_resources_init (MetaKmsResources *resources, - int fd, - GError **error) +meta_kms_resources_init (MetaKmsResources *resources, + int fd, + GError **error) { drmModeRes *drm_resources; @@ -775,8 +779,8 @@ meta_kms_resources_release (MetaKmsResources *resources) } static gboolean -meta_gpu_kms_read_current (MetaGpu *gpu, - GError **error) +meta_gpu_kms_read_current (MetaGpu *gpu, + GError **error) { MetaGpuKms *gpu_kms = META_GPU_KMS (gpu); MetaMonitorManager *monitor_manager = @@ -788,8 +792,9 @@ meta_gpu_kms_read_current (MetaGpu *gpu, { if (!gpu_kms->resources_init_failed_before) { - g_warning ("meta_kms_resources_init failed: %s, assuming we have no outputs", - local_error->message); + g_warning ( + "meta_kms_resources_init failed: %s, assuming we have no outputs", + local_error->message); gpu_kms->resources_init_failed_before = TRUE; } return TRUE; @@ -801,9 +806,9 @@ meta_gpu_kms_read_current (MetaGpu *gpu, monitor_manager->power_save_mode = META_POWER_SAVE_ON; /* Note: we must not free the public structures (output, crtc, monitor - mode and monitor info) here, they must be kept alive until the API - users are done with them after we emit monitors-changed, and thus - are freed by the platform-independent layer. */ + * mode and monitor info) here, they must be kept alive until the API + * users are done with them after we emit monitors-changed, and thus + * are freed by the platform-independent layer. */ free_resources (gpu_kms); init_connectors (gpu_kms, resources.resources); @@ -823,9 +828,9 @@ meta_gpu_kms_can_have_outputs (MetaGpuKms *gpu_kms) } MetaGpuKms * -meta_gpu_kms_new (MetaMonitorManagerKms *monitor_manager_kms, - const char *kms_file_path, - GError **error) +meta_gpu_kms_new (MetaMonitorManagerKms *monitor_manager_kms, + const char *kms_file_path, + GError **error) { MetaMonitorManager *monitor_manager = META_MONITOR_MANAGER (monitor_manager_kms); diff --git a/src/backends/native/meta-input-settings-native.c b/src/backends/native/meta-input-settings-native.c index 0e00c0202..a0c515907 100644 --- a/src/backends/native/meta-input-settings-native.c +++ b/src/backends/native/meta-input-settings-native.c @@ -31,12 +31,13 @@ #include "backends/native/meta-input-settings-native.h" #include "clutter/evdev/clutter-evdev.h" -G_DEFINE_TYPE (MetaInputSettingsNative, meta_input_settings_native, META_TYPE_INPUT_SETTINGS) +G_DEFINE_TYPE (MetaInputSettingsNative, meta_input_settings_native, + META_TYPE_INPUT_SETTINGS) static void -meta_input_settings_native_set_send_events (MetaInputSettings *settings, - ClutterInputDevice *device, - GDesktopDeviceSendEvents mode) +meta_input_settings_native_set_send_events (MetaInputSettings *settings, + ClutterInputDevice *device, + GDesktopDeviceSendEvents mode) { enum libinput_config_send_events_mode libinput_mode; struct libinput_device *libinput_device; @@ -122,9 +123,10 @@ meta_input_settings_native_set_tap_enabled (MetaInputSettings *settings, } static void -meta_input_settings_native_set_tap_and_drag_enabled (MetaInputSettings *settings, - ClutterInputDevice *device, - gboolean enabled) +meta_input_settings_native_set_tap_and_drag_enabled ( + MetaInputSettings *settings, + ClutterInputDevice *device, + gboolean enabled) { struct libinput_device *libinput_device; @@ -140,9 +142,10 @@ meta_input_settings_native_set_tap_and_drag_enabled (MetaInputSettings *setting } static void -meta_input_settings_native_set_disable_while_typing (MetaInputSettings *settings, - ClutterInputDevice *device, - gboolean enabled) +meta_input_settings_native_set_disable_while_typing ( + MetaInputSettings *settings, + ClutterInputDevice *device, + gboolean enabled) { struct libinput_device *libinput_device; @@ -175,8 +178,8 @@ meta_input_settings_native_set_invert_scroll (MetaInputSettings *settings, } static gboolean -device_set_scroll_method (struct libinput_device *libinput_device, - enum libinput_config_scroll_method method) +device_set_scroll_method (struct libinput_device *libinput_device, + enum libinput_config_scroll_method method) { enum libinput_config_status status = libinput_device_config_scroll_set_method (libinput_device, method); @@ -184,8 +187,8 @@ device_set_scroll_method (struct libinput_device *libinput_device, } static gboolean -device_set_click_method (struct libinput_device *libinput_device, - enum libinput_config_click_method method) +device_set_click_method (struct libinput_device *libinput_device, + enum libinput_config_click_method method) { enum libinput_config_status status = libinput_device_config_click_set_method (libinput_device, method); @@ -193,16 +196,18 @@ device_set_click_method (struct libinput_device *libinput_device, } static void -meta_input_settings_native_set_edge_scroll (MetaInputSettings *settings, - ClutterInputDevice *device, - gboolean edge_scrolling_enabled) +meta_input_settings_native_set_edge_scroll (MetaInputSettings *settings, + ClutterInputDevice *device, + gboolean edge_scrolling_enabled) { struct libinput_device *libinput_device; enum libinput_config_scroll_method current, method; libinput_device = clutter_evdev_input_device_get_libinput_device (device); - method = edge_scrolling_enabled ? LIBINPUT_CONFIG_SCROLL_EDGE : LIBINPUT_CONFIG_SCROLL_NO_SCROLL; + method = + edge_scrolling_enabled ? LIBINPUT_CONFIG_SCROLL_EDGE : + LIBINPUT_CONFIG_SCROLL_NO_SCROLL; current = libinput_device_config_scroll_get_method (libinput_device); current &= ~LIBINPUT_CONFIG_SCROLL_EDGE; @@ -210,16 +215,18 @@ meta_input_settings_native_set_edge_scroll (MetaInputSettings *settin } static void -meta_input_settings_native_set_two_finger_scroll (MetaInputSettings *settings, - ClutterInputDevice *device, - gboolean two_finger_scroll_enabled) +meta_input_settings_native_set_two_finger_scroll (MetaInputSettings *settings, + ClutterInputDevice *device, + gboolean two_finger_scroll_enabled) { struct libinput_device *libinput_device; enum libinput_config_scroll_method current, method; libinput_device = clutter_evdev_input_device_get_libinput_device (device); - method = two_finger_scroll_enabled ? LIBINPUT_CONFIG_SCROLL_2FG : LIBINPUT_CONFIG_SCROLL_NO_SCROLL; + method = + two_finger_scroll_enabled ? LIBINPUT_CONFIG_SCROLL_2FG : + LIBINPUT_CONFIG_SCROLL_NO_SCROLL; current = libinput_device_config_scroll_get_method (libinput_device); current &= ~LIBINPUT_CONFIG_SCROLL_2FG; @@ -236,7 +243,8 @@ meta_input_settings_native_has_two_finger_scroll (MetaInputSettings *settings, if (!libinput_device) return FALSE; - return libinput_device_config_scroll_get_methods (libinput_device) & LIBINPUT_CONFIG_SCROLL_2FG; + return libinput_device_config_scroll_get_methods (libinput_device) & + LIBINPUT_CONFIG_SCROLL_2FG; } static void @@ -275,9 +283,10 @@ meta_input_settings_native_set_scroll_button (MetaInputSettings *settings, } static void -meta_input_settings_native_set_click_method (MetaInputSettings *settings, - ClutterInputDevice *device, - GDesktopTouchpadClickMethod mode) +meta_input_settings_native_set_click_method ( + MetaInputSettings *settings, + ClutterInputDevice *device, + GDesktopTouchpadClickMethod mode) { enum libinput_config_click_method click_method = 0; struct libinput_device *libinput_device; @@ -289,7 +298,8 @@ meta_input_settings_native_set_click_method (MetaInputSettings *settin switch (mode) { case G_DESKTOP_TOUCHPAD_CLICK_METHOD_DEFAULT: - click_method = libinput_device_config_click_get_default_method (libinput_device); + click_method = libinput_device_config_click_get_default_method ( + libinput_device); break; case G_DESKTOP_TOUCHPAD_CLICK_METHOD_NONE: click_method = LIBINPUT_CONFIG_CLICK_METHOD_NONE; @@ -303,7 +313,7 @@ meta_input_settings_native_set_click_method (MetaInputSettings *settin default: g_assert_not_reached (); return; - } + } device_set_click_method (libinput_device, click_method); } @@ -405,9 +415,10 @@ meta_input_settings_native_is_trackball_device (MetaInputSettings *settings, } static void -meta_input_settings_native_set_mouse_accel_profile (MetaInputSettings *settings, - ClutterInputDevice *device, - GDesktopPointerAccelProfile profile) +meta_input_settings_native_set_mouse_accel_profile ( + MetaInputSettings *settings, + ClutterInputDevice *device, + GDesktopPointerAccelProfile profile) { if (!is_mouse_device (device)) return; @@ -416,9 +427,10 @@ meta_input_settings_native_set_mouse_accel_profile (MetaInputSettings * } static void -meta_input_settings_native_set_trackball_accel_profile (MetaInputSettings *settings, - ClutterInputDevice *device, - GDesktopPointerAccelProfile profile) +meta_input_settings_native_set_trackball_accel_profile ( + MetaInputSettings *settings, + ClutterInputDevice *device, + GDesktopPointerAccelProfile profile) { if (!meta_input_settings_native_is_trackball_device (settings, device)) return; @@ -427,9 +439,9 @@ meta_input_settings_native_set_trackball_accel_profile (MetaInputSettings } static void -meta_input_settings_native_set_tablet_mapping (MetaInputSettings *settings, - ClutterInputDevice *device, - GDesktopTabletMapping mapping) +meta_input_settings_native_set_tablet_mapping (MetaInputSettings *settings, + ClutterInputDevice *device, + GDesktopTabletMapping mapping) { ClutterInputDeviceMapping dev_mapping; @@ -467,9 +479,9 @@ meta_input_settings_native_set_tablet_keep_aspect (MetaInputSettings *settings, backend = meta_get_backend (); monitor_manager = meta_backend_get_monitor_manager (backend); - meta_monitor_manager_get_screen_size (monitor_manager, - &width, - &height); + meta_monitor_manager_get_screen_size (monitor_manager, + &width, + &height); } aspect_ratio = (double) width / height; @@ -497,8 +509,11 @@ meta_input_settings_native_set_tablet_area (MetaInputSettings *settings, offset_x = -padding_left * scale_x; offset_y = -padding_top * scale_y; - gfloat matrix[6] = { scale_x, 0., offset_x, - 0., scale_y, offset_y }; + gfloat matrix[6] = + { + scale_x, 0., offset_x, + 0., scale_y, offset_y + }; libinput_device = clutter_evdev_input_device_get_libinput_device (device); if (!libinput_device || @@ -509,10 +524,11 @@ meta_input_settings_native_set_tablet_area (MetaInputSettings *settings, } static void -meta_input_settings_native_set_stylus_pressure (MetaInputSettings *settings, - ClutterInputDevice *device, - ClutterInputDeviceTool *tool, - const gint curve[4]) +meta_input_settings_native_set_stylus_pressure ( + MetaInputSettings *settings, + ClutterInputDevice *device, + ClutterInputDeviceTool *tool, + const gint curve[4]) { gdouble pressure_curve[4]; @@ -544,16 +560,18 @@ action_to_evcode (GDesktopStylusButtonAction action) } static void -meta_input_settings_native_set_stylus_button_map (MetaInputSettings *settings, - ClutterInputDevice *device, - ClutterInputDeviceTool *tool, - GDesktopStylusButtonAction primary, - GDesktopStylusButtonAction secondary, - GDesktopStylusButtonAction tertiary) +meta_input_settings_native_set_stylus_button_map ( + MetaInputSettings *settings, + ClutterInputDevice *device, + ClutterInputDeviceTool *tool, + GDesktopStylusButtonAction primary, + GDesktopStylusButtonAction secondary, + GDesktopStylusButtonAction tertiary) { clutter_evdev_input_device_tool_set_button_code (tool, CLUTTER_BUTTON_MIDDLE, action_to_evcode (primary)); - clutter_evdev_input_device_tool_set_button_code (tool, CLUTTER_BUTTON_SECONDARY, + clutter_evdev_input_device_tool_set_button_code (tool, + CLUTTER_BUTTON_SECONDARY, action_to_evcode (secondary)); clutter_evdev_input_device_tool_set_button_code (tool, 8, /* Back */ action_to_evcode (tertiary)); @@ -562,34 +580,55 @@ meta_input_settings_native_set_stylus_button_map (MetaInputSettings *se static void meta_input_settings_native_class_init (MetaInputSettingsNativeClass *klass) { - MetaInputSettingsClass *input_settings_class = META_INPUT_SETTINGS_CLASS (klass); + MetaInputSettingsClass *input_settings_class = META_INPUT_SETTINGS_CLASS ( + klass); - input_settings_class->set_send_events = meta_input_settings_native_set_send_events; + input_settings_class->set_send_events = + meta_input_settings_native_set_send_events; input_settings_class->set_matrix = meta_input_settings_native_set_matrix; input_settings_class->set_speed = meta_input_settings_native_set_speed; - input_settings_class->set_left_handed = meta_input_settings_native_set_left_handed; - input_settings_class->set_tap_enabled = meta_input_settings_native_set_tap_enabled; - input_settings_class->set_tap_and_drag_enabled = meta_input_settings_native_set_tap_and_drag_enabled; - input_settings_class->set_invert_scroll = meta_input_settings_native_set_invert_scroll; - input_settings_class->set_edge_scroll = meta_input_settings_native_set_edge_scroll; - input_settings_class->set_two_finger_scroll = meta_input_settings_native_set_two_finger_scroll; - input_settings_class->set_scroll_button = meta_input_settings_native_set_scroll_button; - input_settings_class->set_click_method = meta_input_settings_native_set_click_method; - input_settings_class->set_keyboard_repeat = meta_input_settings_native_set_keyboard_repeat; - input_settings_class->set_disable_while_typing = meta_input_settings_native_set_disable_while_typing; - - input_settings_class->set_tablet_mapping = meta_input_settings_native_set_tablet_mapping; - input_settings_class->set_tablet_keep_aspect = meta_input_settings_native_set_tablet_keep_aspect; - input_settings_class->set_tablet_area = meta_input_settings_native_set_tablet_area; - - input_settings_class->set_mouse_accel_profile = meta_input_settings_native_set_mouse_accel_profile; - input_settings_class->set_trackball_accel_profile = meta_input_settings_native_set_trackball_accel_profile; - - input_settings_class->set_stylus_pressure = meta_input_settings_native_set_stylus_pressure; - input_settings_class->set_stylus_button_map = meta_input_settings_native_set_stylus_button_map; - - input_settings_class->has_two_finger_scroll = meta_input_settings_native_has_two_finger_scroll; - input_settings_class->is_trackball_device = meta_input_settings_native_is_trackball_device; + input_settings_class->set_left_handed = + meta_input_settings_native_set_left_handed; + input_settings_class->set_tap_enabled = + meta_input_settings_native_set_tap_enabled; + input_settings_class->set_tap_and_drag_enabled = + meta_input_settings_native_set_tap_and_drag_enabled; + input_settings_class->set_invert_scroll = + meta_input_settings_native_set_invert_scroll; + input_settings_class->set_edge_scroll = + meta_input_settings_native_set_edge_scroll; + input_settings_class->set_two_finger_scroll = + meta_input_settings_native_set_two_finger_scroll; + input_settings_class->set_scroll_button = + meta_input_settings_native_set_scroll_button; + input_settings_class->set_click_method = + meta_input_settings_native_set_click_method; + input_settings_class->set_keyboard_repeat = + meta_input_settings_native_set_keyboard_repeat; + input_settings_class->set_disable_while_typing = + meta_input_settings_native_set_disable_while_typing; + + input_settings_class->set_tablet_mapping = + meta_input_settings_native_set_tablet_mapping; + input_settings_class->set_tablet_keep_aspect = + meta_input_settings_native_set_tablet_keep_aspect; + input_settings_class->set_tablet_area = + meta_input_settings_native_set_tablet_area; + + input_settings_class->set_mouse_accel_profile = + meta_input_settings_native_set_mouse_accel_profile; + input_settings_class->set_trackball_accel_profile = + meta_input_settings_native_set_trackball_accel_profile; + + input_settings_class->set_stylus_pressure = + meta_input_settings_native_set_stylus_pressure; + input_settings_class->set_stylus_button_map = + meta_input_settings_native_set_stylus_button_map; + + input_settings_class->has_two_finger_scroll = + meta_input_settings_native_has_two_finger_scroll; + input_settings_class->is_trackball_device = + meta_input_settings_native_is_trackball_device; } static void diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c index a43c1cc3d..5212dd748 100644 --- a/src/backends/native/meta-launcher.c +++ b/src/backends/native/meta-launcher.c @@ -60,10 +60,13 @@ meta_launcher_get_seat_id (MetaLauncher *launcher) } static gboolean -find_systemd_session (gchar **session_id, +find_systemd_session (gchar **session_id, GError **error) { - const gchar * const graphical_session_types[] = { "wayland", "x11", "mir", NULL }; + const gchar * const graphical_session_types[] = + { + "wayland", "x11", "mir", NULL + }; const gchar * const active_states[] = { "active", "online", NULL }; g_autofree gchar *class = NULL; g_autofree gchar *local_session_id = NULL; @@ -116,43 +119,43 @@ find_systemd_session (gchar **session_id, return FALSE; } - if (n_sessions == 0) - { - g_set_error (error, - G_IO_ERROR, - G_IO_ERROR_NOT_FOUND, - "User %d has no sessions", - getuid ()); - return FALSE; - } - - for (int i = 0; i < n_sessions; ++i) - { - saved_errno = sd_session_get_class (sessions[i], &class); - if (saved_errno < 0) - { - g_warning ("Couldn't get class for session '%d': %s", - i, - g_strerror (-saved_errno)); - continue; - } - - if (g_strcmp0 (class, "greeter") == 0) - { - local_session_id = g_strdup (sessions[i]); - break; - } - } - - if (!local_session_id) - { - g_set_error (error, - G_IO_ERROR, - G_IO_ERROR_NOT_FOUND, - "Couldn't find a session or a greeter session for user %d", - getuid ()); - return FALSE; - } + if (n_sessions == 0) + { + g_set_error (error, + G_IO_ERROR, + G_IO_ERROR_NOT_FOUND, + "User %d has no sessions", + getuid ()); + return FALSE; + } + + for (int i = 0; i < n_sessions; ++i) + { + saved_errno = sd_session_get_class (sessions[i], &class); + if (saved_errno < 0) + { + g_warning ("Couldn't get class for session '%d': %s", + i, + g_strerror (-saved_errno)); + continue; + } + + if (g_strcmp0 (class, "greeter") == 0) + { + local_session_id = g_strdup (sessions[i]); + break; + } + } + + if (!local_session_id) + { + g_set_error (error, + G_IO_ERROR, + G_IO_ERROR_NOT_FOUND, + "Couldn't find a session or a greeter session for user %d", + getuid ()); + return FALSE; + } } else { @@ -191,29 +194,29 @@ find_systemd_session (gchar **session_id, return FALSE; } - /* and display sessions can be 'closing' if they are logged out but - * some processes are lingering; we shouldn't consider these */ - saved_errno = sd_session_get_state (local_session_id, &state); - if (saved_errno < 0) - { - g_set_error (error, - G_IO_ERROR, - G_IO_ERROR_NOT_FOUND, - "Couldn't get state for session '%s': %s", - local_session_id, - g_strerror (-saved_errno)); - return FALSE; - } - - if (!g_strv_contains (active_states, state)) - { - g_set_error (error, - G_IO_ERROR, - G_IO_ERROR_NOT_FOUND, - "Session '%s' is not active", - local_session_id); - return FALSE; - } + /* and display sessions can be 'closing' if they are logged out but + * some processes are lingering; we shouldn't consider these */ + saved_errno = sd_session_get_state (local_session_id, &state); + if (saved_errno < 0) + { + g_set_error (error, + G_IO_ERROR, + G_IO_ERROR_NOT_FOUND, + "Couldn't get state for session '%s': %s", + local_session_id, + g_strerror (-saved_errno)); + return FALSE; + } + + if (!g_strv_contains (active_states, state)) + { + g_set_error (error, + G_IO_ERROR, + G_IO_ERROR_NOT_FOUND, + "Session '%s' is not active", + local_session_id); + return FALSE; + } *session_id = g_steal_pointer (&local_session_id); @@ -231,11 +234,13 @@ get_session_proxy (GCancellable *cancellable, if (!find_systemd_session (&session_id, &local_error)) { - g_propagate_prefixed_error (error, local_error, "Could not get session ID: "); + g_propagate_prefixed_error (error, local_error, + "Could not get session ID: "); return NULL; } - proxy_path = get_escaped_dbus_path ("/org/freedesktop/login1/session", session_id); + proxy_path = get_escaped_dbus_path ("/org/freedesktop/login1/session", + session_id); session_proxy = login1_session_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, @@ -243,7 +248,7 @@ get_session_proxy (GCancellable *cancellable, proxy_path, cancellable, error); if (!session_proxy) - g_prefix_error(error, "Could not get session proxy: "); + g_prefix_error (error, "Could not get session proxy: "); return session_proxy; } @@ -258,7 +263,7 @@ get_seat_proxy (GCancellable *cancellable, "/org/freedesktop/login1/seat/self", cancellable, error); if (!seat) - g_prefix_error(error, "Could not get seat proxy: "); + g_prefix_error (error, "Could not get seat proxy: "); return seat; } @@ -377,10 +382,10 @@ out: } static int -on_evdev_device_open (const char *path, - int flags, - gpointer user_data, - GError **error) +on_evdev_device_open (const char *path, + int flags, + gpointer user_data, + GError **error) { MetaLauncher *self = user_data; @@ -433,7 +438,8 @@ sync_active (MetaLauncher *self) { MetaBackend *backend = meta_get_backend (); MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend); - gboolean active = login1_session_get_active (LOGIN1_SESSION (self->session_proxy)); + gboolean active = + login1_session_get_active (LOGIN1_SESSION (self->session_proxy)); if (active == self->session_active) return; @@ -465,7 +471,8 @@ get_seat_id (GError **error) if (!find_systemd_session (&session_id, &local_error)) { - g_propagate_prefixed_error (error, local_error, "Could not get session ID: "); + g_propagate_prefixed_error (error, local_error, + "Could not get session ID: "); return NULL; } @@ -495,7 +502,8 @@ meta_launcher_new (GError **error) if (!session_proxy) goto fail; - if (!login1_session_call_take_control_sync (session_proxy, FALSE, NULL, error)) + if (!login1_session_call_take_control_sync (session_proxy, FALSE, NULL, + error)) { g_prefix_error (error, "Could not take control: "); goto fail; @@ -524,11 +532,12 @@ meta_launcher_new (GError **error) on_evdev_device_close, self); - g_signal_connect (self->session_proxy, "notify::active", G_CALLBACK (on_active_changed), self); + g_signal_connect (self->session_proxy, "notify::active", + G_CALLBACK (on_active_changed), self); return self; - fail: +fail: if (have_control) login1_session_call_release_control_sync (session_proxy, NULL, NULL); return NULL; @@ -545,8 +554,8 @@ meta_launcher_free (MetaLauncher *self) } gboolean -meta_launcher_activate_session (MetaLauncher *launcher, - GError **error) +meta_launcher_activate_session (MetaLauncher *launcher, + GError **error) { if (!login1_session_call_activate_sync (launcher->session_proxy, NULL, error)) return FALSE; @@ -556,9 +565,10 @@ meta_launcher_activate_session (MetaLauncher *launcher, } gboolean -meta_launcher_activate_vt (MetaLauncher *launcher, - signed char vt, - GError **error) +meta_launcher_activate_vt (MetaLauncher *launcher, + signed char vt, + GError **error) { - return login1_seat_call_switch_to_sync (launcher->seat_proxy, vt, NULL, error); + return login1_seat_call_switch_to_sync (launcher->seat_proxy, vt, NULL, + error); } diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c index 3e80373dc..fa28da7bf 100644 --- a/src/backends/native/meta-monitor-manager-kms.c +++ b/src/backends/native/meta-monitor-manager-kms.c @@ -82,8 +82,8 @@ G_DEFINE_TYPE_WITH_CODE (MetaMonitorManagerKms, meta_monitor_manager_kms, initable_iface_init)) static GBytes * -meta_monitor_manager_kms_read_edid (MetaMonitorManager *manager, - MetaOutput *output) +meta_monitor_manager_kms_read_edid (MetaMonitorManager * manager, + MetaOutput * output) { return meta_output_kms_read_edid (output); } @@ -95,22 +95,23 @@ meta_monitor_manager_kms_set_power_save_mode (MetaMonitorManager *manager, uint64_t state; GList *l; - switch (mode) { - case META_POWER_SAVE_ON: - state = DRM_MODE_DPMS_ON; - break; - case META_POWER_SAVE_STANDBY: - state = DRM_MODE_DPMS_STANDBY; - break; - case META_POWER_SAVE_SUSPEND: - state = DRM_MODE_DPMS_SUSPEND; - break; - case META_POWER_SAVE_OFF: - state = DRM_MODE_DPMS_OFF; - break; - default: - return; - } + switch (mode) + { + case META_POWER_SAVE_ON: + state = DRM_MODE_DPMS_ON; + break; + case META_POWER_SAVE_STANDBY: + state = DRM_MODE_DPMS_STANDBY; + break; + case META_POWER_SAVE_SUSPEND: + state = DRM_MODE_DPMS_SUSPEND; + break; + case META_POWER_SAVE_OFF: + state = DRM_MODE_DPMS_OFF; + break; + default: + return; + } for (l = manager->gpus; l; l = l->next) { @@ -132,10 +133,10 @@ meta_monitor_manager_kms_ensure_initial_config (MetaMonitorManager *manager) static void apply_crtc_assignments (MetaMonitorManager *manager, - MetaCrtcInfo **crtcs, - unsigned int n_crtcs, - MetaOutputInfo **outputs, - unsigned int n_outputs) + MetaCrtcInfo **crtcs, + unsigned int n_crtcs, + MetaOutputInfo **outputs, + unsigned int n_outputs) { unsigned i; GList *l; @@ -193,7 +194,7 @@ apply_crtc_assignments (MetaMonitorManager *manager, meta_crtc_kms_apply_transform (crtc); } /* Disable CRTCs not mentioned in the list (they have is_dirty == FALSE, - because they weren't seen in the first loop) */ + * because they weren't seen in the first loop) */ for (l = manager->gpus; l; l = l->next) { MetaGpu *gpu = l->data; @@ -283,10 +284,11 @@ update_screen_size (MetaMonitorManager *manager, } static gboolean -meta_monitor_manager_kms_apply_monitors_config (MetaMonitorManager *manager, - MetaMonitorsConfig *config, - MetaMonitorsConfigMethod method, - GError **error) +meta_monitor_manager_kms_apply_monitors_config ( + MetaMonitorManager *manager, + MetaMonitorsConfig *config, + MetaMonitorsConfigMethod method, + GError **error) { GPtrArray *crtc_infos; GPtrArray *output_infos; @@ -327,12 +329,12 @@ meta_monitor_manager_kms_apply_monitors_config (MetaMonitorManager *manager } static void -meta_monitor_manager_kms_get_crtc_gamma (MetaMonitorManager *manager, - MetaCrtc *crtc, - gsize *size, - unsigned short **red, - unsigned short **green, - unsigned short **blue) +meta_monitor_manager_kms_get_crtc_gamma (MetaMonitorManager *manager, + MetaCrtc *crtc, + gsize *size, + unsigned short **red, + unsigned short **green, + unsigned short **blue) { MetaGpu *gpu = meta_crtc_get_gpu (crtc); int kms_fd = meta_gpu_kms_get_fd (META_GPU_KMS (gpu)); @@ -387,7 +389,8 @@ on_uevent (GUdevClient *client, } static void -meta_monitor_manager_kms_connect_uevent_handler (MetaMonitorManagerKms *manager_kms) +meta_monitor_manager_kms_connect_uevent_handler ( + MetaMonitorManagerKms *manager_kms) { manager_kms->uevent_handler_id = g_signal_connect (manager_kms->udev, "uevent", @@ -396,7 +399,8 @@ meta_monitor_manager_kms_connect_uevent_handler (MetaMonitorManagerKms *manager_ } static void -meta_monitor_manager_kms_disconnect_uevent_handler (MetaMonitorManagerKms *manager_kms) +meta_monitor_manager_kms_disconnect_uevent_handler ( + MetaMonitorManagerKms *manager_kms) { g_signal_handler_disconnect (manager_kms->udev, manager_kms->uevent_handler_id); @@ -427,19 +431,21 @@ meta_monitor_manager_kms_is_transform_handled (MetaMonitorManager *manager, } static float -meta_monitor_manager_kms_calculate_monitor_mode_scale (MetaMonitorManager *manager, - MetaMonitor *monitor, - MetaMonitorMode *monitor_mode) +meta_monitor_manager_kms_calculate_monitor_mode_scale ( + MetaMonitorManager *manager, + MetaMonitor *monitor, + MetaMonitorMode *monitor_mode) { return meta_monitor_calculate_mode_scale (monitor, monitor_mode); } static float * -meta_monitor_manager_kms_calculate_supported_scales (MetaMonitorManager *manager, - MetaLogicalMonitorLayoutMode layout_mode, - MetaMonitor *monitor, - MetaMonitorMode *monitor_mode, - int *n_supported_scales) +meta_monitor_manager_kms_calculate_supported_scales ( + MetaMonitorManager *manager, + MetaLogicalMonitorLayoutMode layout_mode, + MetaMonitor *monitor, + MetaMonitorMode *monitor_mode, + int *n_supported_scales) { MetaMonitorScalesConstraint constraints = META_MONITOR_SCALES_CONSTRAINT_NONE; @@ -742,15 +748,23 @@ meta_monitor_manager_kms_class_init (MetaMonitorManagerKmsClass *klass) object_class->dispose = meta_monitor_manager_kms_dispose; manager_class->read_edid = meta_monitor_manager_kms_read_edid; - manager_class->ensure_initial_config = meta_monitor_manager_kms_ensure_initial_config; - manager_class->apply_monitors_config = meta_monitor_manager_kms_apply_monitors_config; - manager_class->set_power_save_mode = meta_monitor_manager_kms_set_power_save_mode; + manager_class->ensure_initial_config = + meta_monitor_manager_kms_ensure_initial_config; + manager_class->apply_monitors_config = + meta_monitor_manager_kms_apply_monitors_config; + manager_class->set_power_save_mode = + meta_monitor_manager_kms_set_power_save_mode; manager_class->get_crtc_gamma = meta_monitor_manager_kms_get_crtc_gamma; 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->calculate_supported_scales = meta_monitor_manager_kms_calculate_supported_scales; + 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->calculate_supported_scales = + meta_monitor_manager_kms_calculate_supported_scales; manager_class->get_capabilities = meta_monitor_manager_kms_get_capabilities; - manager_class->get_max_screen_size = meta_monitor_manager_kms_get_max_screen_size; - manager_class->get_default_layout_mode = meta_monitor_manager_kms_get_default_layout_mode; + manager_class->get_max_screen_size = + meta_monitor_manager_kms_get_max_screen_size; + manager_class->get_default_layout_mode = + meta_monitor_manager_kms_get_default_layout_mode; } diff --git a/src/backends/native/meta-output-kms.c b/src/backends/native/meta-output-kms.c index 2e870658c..a440b3e9a 100644 --- a/src/backends/native/meta-output-kms.c +++ b/src/backends/native/meta-output-kms.c @@ -182,7 +182,7 @@ output_get_tile_info (MetaGpuKms *gpu_kms, { int ret; - ret = sscanf ((char *)tile_blob->data, "%d:%d:%d:%d:%d:%d:%d:%d", + ret = sscanf ((char *) tile_blob->data, "%d:%d:%d:%d:%d:%d:%d:%d", &output->tile_info.group_id, &output->tile_info.flags, &output->tile_info.max_h_tiles, @@ -259,8 +259,8 @@ handle_panel_orientation (MetaOutput *output, } static void -find_connector_properties (MetaGpuKms *gpu_kms, - MetaOutput *output) +find_connector_properties (MetaGpuKms *gpu_kms, + MetaOutput *output) { MetaOutputKms *output_kms = output->driver_private; drmModeConnector *connector = output_kms->connector; @@ -311,7 +311,8 @@ find_connector_properties (MetaGpuKms *gpu_kms, static char * make_output_name (drmModeConnector *connector) { - static const char * const connector_type_names[] = { + static const char * const connector_type_names[] = + { "None", "VGA", "DVI-I", @@ -442,9 +443,9 @@ compare_modes (const void *one, } static gboolean -init_output_modes (MetaOutput *output, - MetaGpuKms *gpu_kms, - GError **error) +init_output_modes (MetaOutput *output, + MetaGpuKms *gpu_kms, + GError **error) { MetaOutputKms *output_kms = output->driver_private; unsigned int i; @@ -488,11 +489,11 @@ init_output_modes (MetaOutput *output, } MetaOutput * -meta_create_kms_output (MetaGpuKms *gpu_kms, - drmModeConnector *connector, - MetaKmsResources *resources, - MetaOutput *old_output, - GError **error) +meta_create_kms_output (MetaGpuKms *gpu_kms, + drmModeConnector *connector, + MetaKmsResources *resources, + MetaOutput *old_output, + GError **error) { MetaGpu *gpu = META_GPU (gpu_kms); MetaOutput *output; @@ -570,17 +571,17 @@ meta_create_kms_output (MetaGpuKms *gpu_kms, continue; /* We only list CRTCs as supported if they are supported by all encoders - for this connectors. - - This is what xf86-video-modesetting does (see drmmode_output_init()) - */ + * for this connectors. + * + * This is what xf86-video-modesetting does (see drmmode_output_init()) + */ crtc_mask &= output_kms->encoders[i]->possible_crtcs; if (output_kms->encoders[i]->encoder_id == connector->encoder_id) output_kms->current_encoder = output_kms->encoders[i]; } - crtcs = g_array_new (FALSE, FALSE, sizeof (MetaCrtc*)); + crtcs = g_array_new (FALSE, FALSE, sizeof (MetaCrtc *)); for (l = meta_gpu_get_crtcs (gpu), i = 0; l; l = l->next, i++) { @@ -593,7 +594,7 @@ meta_create_kms_output (MetaGpuKms *gpu_kms, } output->n_possible_crtcs = crtcs->len; - output->possible_crtcs = (void*)g_array_free (crtcs, FALSE); + output->possible_crtcs = (void *) g_array_free (crtcs, FALSE); if (output_kms->current_encoder && output_kms->current_encoder->crtc_id != 0) { @@ -654,14 +655,16 @@ meta_create_kms_output (MetaGpuKms *gpu_kms, output_get_tile_info (gpu_kms, output); /* FIXME: backlight is a very driver specific thing unfortunately, - every DDX does its own thing, and the dumb KMS API does not include it. - - For example, xf86-video-intel has a list of paths to probe in /sys/class/backlight - (one for each major HW maker, and then some). - We can't do the same because we're not root. - It might be best to leave backlight out of the story and rely on the setuid - helper in gnome-settings-daemon. - */ + * every DDX does its own thing, and the dumb KMS API does not include it. + * + * For example, xf86-video-intel has a list of paths to probe in + * /sys/class/backlight + * (one for each major HW maker, and then some). + * We can't do the same because we're not root. + * It might be best to leave backlight out of the story and rely on the + * setuid + * helper in gnome-settings-daemon. + */ output->backlight_min = 0; output->backlight_max = 0; output->backlight = -1; diff --git a/src/backends/native/meta-renderer-native-gles3.c b/src/backends/native/meta-renderer-native-gles3.c index 71a440832..109e26ceb 100644 --- a/src/backends/native/meta-renderer-native-gles3.c +++ b/src/backends/native/meta-renderer-native-gles3.c @@ -46,18 +46,18 @@ #endif static EGLImageKHR -create_egl_image (MetaEgl *egl, - EGLDisplay egl_display, - EGLContext egl_context, - unsigned int width, - unsigned int height, - uint32_t n_planes, - uint32_t *strides, - uint32_t *offsets, - uint64_t *modifiers, - uint32_t format, - int fd, - GError **error) +create_egl_image (MetaEgl *egl, + EGLDisplay egl_display, + EGLContext egl_context, + unsigned int width, + unsigned int height, + uint32_t n_planes, + uint32_t *strides, + uint32_t *offsets, + uint64_t *modifiers, + uint32_t format, + int fd, + GError **error) { EGLint attribs[37]; int atti = 0; @@ -141,10 +141,10 @@ create_egl_image (MetaEgl *egl, } static void -paint_egl_image (MetaGles3 *gles3, - EGLImageKHR egl_image, - int width, - int height) +paint_egl_image (MetaGles3 *gles3, + EGLImageKHR egl_image, + int width, + int height) { GLuint texture; GLuint framebuffer; @@ -169,8 +169,9 @@ paint_egl_image (MetaGles3 *gles3, GLBAS (gles3, glTexParameteri, (GL_TEXTURE_2D, GL_TEXTURE_WRAP_R_OES, GL_CLAMP_TO_EDGE)); - GLBAS (gles3, glFramebufferTexture2D, (GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, texture, 0)); + GLBAS (gles3, glFramebufferTexture2D, + (GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, texture, 0)); GLBAS (gles3, glBindFramebuffer, (GL_READ_FRAMEBUFFER, framebuffer)); GLBAS (gles3, glBlitFramebuffer, (0, height, width, 0, @@ -180,13 +181,13 @@ paint_egl_image (MetaGles3 *gles3, } gboolean -meta_renderer_native_gles3_blit_shared_bo (MetaEgl *egl, - MetaGles3 *gles3, - EGLDisplay egl_display, - EGLContext egl_context, - EGLSurface egl_surface, - struct gbm_bo *shared_bo, - GError **error) +meta_renderer_native_gles3_blit_shared_bo (MetaEgl *egl, + MetaGles3 *gles3, + EGLDisplay egl_display, + EGLContext egl_context, + EGLSurface egl_surface, + struct gbm_bo *shared_bo, + GError **error) { int shared_bo_fd; unsigned int width; diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c index ad4f289c9..832c5f6da 100644 --- a/src/backends/native/meta-renderer-native.c +++ b/src/backends/native/meta-renderer-native.c @@ -90,12 +90,14 @@ typedef struct _MetaRendererNativeGpuData { MetaRendererNative *renderer_native; - struct { + struct + { struct gbm_device *device; } gbm; #ifdef HAVE_EGL_DEVICE - struct { + struct + { EGLDeviceEXT device; gboolean no_egl_output_drm_flip_event; @@ -109,7 +111,8 @@ typedef struct _MetaRendererNativeGpuData /* * Fields used for blitting iGPU framebuffer content onto dGPU framebuffers. */ - struct { + struct + { MetaSharedFramebufferCopyMode copy_mode; /* For GPU blit mode */ @@ -136,7 +139,8 @@ typedef struct _MetaOnscreenNativeSecondaryGpuState EGLSurface egl_surface; - struct { + struct + { struct gbm_surface *surface; uint32_t current_fb_id; uint32_t next_fb_id; @@ -144,7 +148,8 @@ typedef struct _MetaOnscreenNativeSecondaryGpuState struct gbm_bo *next_bo; } gbm; - struct { + struct + { MetaDumbBuffer *dumb_fb; MetaDumbBuffer dumb_fbs[2]; } cpu; @@ -160,7 +165,8 @@ typedef struct _MetaOnscreenNative GHashTable *secondary_gpu_states; - struct { + struct + { struct gbm_surface *surface; uint32_t current_fb_id; uint32_t next_fb_id; @@ -169,7 +175,8 @@ typedef struct _MetaOnscreenNative } gbm; #ifdef HAVE_EGL_DEVICE - struct { + struct + { EGLStreamKHR stream; MetaDumbBuffer dumb_fb; @@ -465,7 +472,8 @@ get_supported_egl_modifiers (CoglOnscreen *onscreen, num_modifiers); ret = meta_egl_query_dma_buf_modifiers (egl, renderer_gpu_data->egl_display, format, num_modifiers, - (EGLuint64KHR *) modifiers->data, NULL, + (EGLuint64KHR *) modifiers->data, + NULL, &num_modifiers, &error); if (!ret) @@ -556,11 +564,12 @@ get_supported_modifiers (CoglOnscreen *onscreen, } static gboolean -init_secondary_gpu_state_gpu_copy_mode (MetaRendererNative *renderer_native, - CoglOnscreen *onscreen, - MetaRendererNativeGpuData *renderer_gpu_data, - MetaGpuKms *gpu_kms, - GError **error) +init_secondary_gpu_state_gpu_copy_mode ( + MetaRendererNative *renderer_native, + CoglOnscreen *onscreen, + MetaRendererNativeGpuData *renderer_gpu_data, + MetaGpuKms *gpu_kms, + GError **error) { CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); CoglOnscreenEGL *onscreen_egl = onscreen->winsys; @@ -614,7 +623,8 @@ init_secondary_gpu_state_gpu_copy_mode (MetaRendererNative *renderer_nat } static void -secondary_gpu_state_free (MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state) +secondary_gpu_state_free ( + MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state) { MetaBackend *backend = meta_get_backend (); MetaEgl *egl = meta_backend_get_egl (backend); @@ -648,11 +658,12 @@ secondary_gpu_state_free (MetaOnscreenNativeSecondaryGpuState *secondary_gpu_sta } static gboolean -init_secondary_gpu_state_cpu_copy_mode (MetaRendererNative *renderer_native, - CoglOnscreen *onscreen, - MetaRendererNativeGpuData *renderer_gpu_data, - MetaGpuKms *gpu_kms, - GError **error) +init_secondary_gpu_state_cpu_copy_mode ( + MetaRendererNative *renderer_native, + CoglOnscreen *onscreen, + MetaRendererNativeGpuData *renderer_gpu_data, + MetaGpuKms *gpu_kms, + GError **error) { CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); CoglOnscreenEGL *onscreen_egl = onscreen->winsys; @@ -691,10 +702,10 @@ init_secondary_gpu_state_cpu_copy_mode (MetaRendererNative *renderer_nat } static gboolean -init_secondary_gpu_state (MetaRendererNative *renderer_native, - CoglOnscreen *onscreen, - MetaGpuKms *gpu_kms, - GError **error) +init_secondary_gpu_state (MetaRendererNative *renderer_native, + CoglOnscreen *onscreen, + MetaGpuKms *gpu_kms, + GError **error) { MetaRendererNativeGpuData *renderer_gpu_data; @@ -746,7 +757,8 @@ flush_pending_swap_notify (CoglFramebuffer *framebuffer) CoglFrameInfo *info; while ((info = g_queue_peek_head (&onscreen->pending_frame_infos)) && - info->global_frame_counter <= onscreen_native->pending_swap_notify_frame_count) + info->global_frame_counter <= + onscreen_native->pending_swap_notify_frame_count) { _cogl_onscreen_notify_frame_sync (onscreen, info); _cogl_onscreen_notify_complete (onscreen, info); @@ -846,7 +858,7 @@ free_current_bo (CoglOnscreen *onscreen) static void meta_onscreen_native_queue_swap_notify (CoglOnscreen *onscreen) { - CoglOnscreenEGL *onscreen_egl = onscreen->winsys; + CoglOnscreenEGL *onscreen_egl = onscreen->winsys; MetaOnscreenNative *onscreen_native = onscreen_egl->platform; MetaRendererNative *renderer_native = onscreen_native->renderer_native; @@ -913,9 +925,10 @@ fail: } static int -meta_renderer_native_add_egl_config_attributes (CoglDisplay *cogl_display, - CoglFramebufferConfig *config, - EGLint *attributes) +meta_renderer_native_add_egl_config_attributes ( + CoglDisplay *cogl_display, + CoglFramebufferConfig *config, + EGLint *attributes) { CoglRendererEGL *cogl_renderer_egl = cogl_display->renderer->winsys; MetaRendererNativeGpuData *renderer_gpu_data = cogl_renderer_egl->platform; @@ -939,12 +952,12 @@ meta_renderer_native_add_egl_config_attributes (CoglDisplay *cogl_disp } static gboolean -choose_egl_config_from_gbm_format (MetaEgl *egl, - EGLDisplay egl_display, - const EGLint *attributes, - uint32_t gbm_format, - EGLConfig *out_config, - GError **error) +choose_egl_config_from_gbm_format (MetaEgl *egl, + EGLDisplay egl_display, + const EGLint *attributes, + uint32_t gbm_format, + EGLConfig *out_config, + GError **error) { EGLConfig *egl_configs; EGLint n_configs; @@ -986,10 +999,10 @@ choose_egl_config_from_gbm_format (MetaEgl *egl, } static gboolean -meta_renderer_native_choose_egl_config (CoglDisplay *cogl_display, - EGLint *attributes, - EGLConfig *out_config, - GError **error) +meta_renderer_native_choose_egl_config (CoglDisplay *cogl_display, + EGLint *attributes, + EGLConfig *out_config, + GError **error) { CoglRenderer *cogl_renderer = cogl_display->renderer; CoglRendererEGL *cogl_renderer_egl = cogl_renderer->winsys; @@ -1051,7 +1064,8 @@ create_dummy_pbuffer_surface (EGLDisplay egl_display, MetaBackend *backend = meta_get_backend (); MetaEgl *egl = meta_backend_get_egl (backend); EGLConfig pbuffer_config; - static const EGLint pbuffer_config_attribs[] = { + static const EGLint pbuffer_config_attribs[] = + { EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, EGL_RED_SIZE, 1, EGL_GREEN_SIZE, 1, @@ -1060,7 +1074,8 @@ create_dummy_pbuffer_surface (EGLDisplay egl_display, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE }; - static const EGLint pbuffer_attribs[] = { + static const EGLint pbuffer_attribs[] = + { EGL_WIDTH, 16, EGL_HEIGHT, 16, EGL_NONE @@ -1098,8 +1113,8 @@ meta_renderer_native_egl_context_created (CoglDisplay *cogl_display, cogl_display_egl->egl_context)) { _cogl_set_error (error, COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_CREATE_CONTEXT, - "Failed to make context current"); + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Failed to make context current"); return FALSE; } @@ -1140,7 +1155,7 @@ swap_secondary_drm_fb (MetaGpuKms *gpu_kms, static void meta_onscreen_native_swap_drm_fb (CoglOnscreen *onscreen) { - CoglOnscreenEGL *onscreen_egl = onscreen->winsys; + CoglOnscreenEGL *onscreen_egl = onscreen->winsys; MetaOnscreenNative *onscreen_native = onscreen_egl->platform; free_current_bo (onscreen); @@ -1165,7 +1180,7 @@ on_crtc_flipped (GClosure *closure, CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (stage_view); CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer); - CoglOnscreenEGL *onscreen_egl = onscreen->winsys; + CoglOnscreenEGL *onscreen_egl = onscreen->winsys; MetaOnscreenNative *onscreen_native = onscreen_egl->platform; MetaRendererNative *renderer_native = onscreen_native->renderer_native; MetaGpuKms *render_gpu = onscreen_native->render_gpu; @@ -1237,7 +1252,7 @@ flip_closure_destroyed (MetaRendererView *view) CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (stage_view); CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer); - CoglOnscreenEGL *onscreen_egl = onscreen->winsys; + CoglOnscreenEGL *onscreen_egl = onscreen->winsys; MetaOnscreenNative *onscreen_native = onscreen_egl->platform; MetaRendererNative *renderer_native = onscreen_native->renderer_native; MetaGpuKms *render_gpu = onscreen_native->render_gpu; @@ -1467,7 +1482,8 @@ meta_onscreen_native_set_crtc_modes (CoglOnscreen *onscreen) logical_monitor = meta_renderer_view_get_logical_monitor (view); if (logical_monitor) { - SetCrtcFbData data = { + SetCrtcFbData data = + { .render_gpu = render_gpu, .onscreen = onscreen, .fb_id = fb_id @@ -1550,7 +1566,8 @@ meta_onscreen_native_flip_crtcs (CoglOnscreen *onscreen) logical_monitor = meta_renderer_view_get_logical_monitor (view); if (logical_monitor) { - FlipCrtcData data = { + FlipCrtcData data = + { .onscreen = onscreen, .flip_closure = flip_closure, }; @@ -1749,8 +1766,10 @@ copy_shared_framebuffer_gpu (CoglOnscreen *onscreen, if (!meta_renderer_native_gles3_blit_shared_bo (egl, renderer_native->gles3, renderer_gpu_data->egl_display, - renderer_gpu_data->secondary.egl_context, - secondary_gpu_state->egl_surface, + renderer_gpu_data->secondary. + egl_context, + secondary_gpu_state-> + egl_surface, onscreen_native->gbm.next_bo, &error)) { @@ -1946,7 +1965,8 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen, onscreen_native->pending_set_crtc = FALSE; } - onscreen_native->pending_queue_swap_notify_frame_count = renderer_native->frame_counter; + onscreen_native->pending_queue_swap_notify_frame_count = + renderer_native->frame_counter; meta_onscreen_native_flip_crtcs (onscreen); /* @@ -2013,8 +2033,9 @@ should_surface_be_sharable (CoglOnscreen *onscreen) MetaMonitor *monitor = l->data; MetaGpuKms *gpu_kms = META_GPU_KMS (meta_monitor_get_gpu (monitor)); - if (renderer_gpu_data != meta_renderer_native_get_gpu_data (renderer_native, - gpu_kms)) + if (renderer_gpu_data != + meta_renderer_native_get_gpu_data (renderer_native, + gpu_kms)) return TRUE; } @@ -2135,12 +2156,14 @@ meta_renderer_native_create_surface_egl_device (CoglOnscreen *onscreen, EGLint num_layers; EGLOutputLayerEXT output_layer; EGLAttrib output_attribs[3]; - EGLint stream_attribs[] = { + EGLint stream_attribs[] = + { EGL_STREAM_FIFO_LENGTH_KHR, 1, EGL_CONSUMER_AUTO_ACQUIRE_EXT, EGL_FALSE, EGL_NONE }; - EGLint stream_producer_attribs[] = { + EGLint stream_producer_attribs[] = + { EGL_WIDTH, width, EGL_HEIGHT, height, EGL_NONE @@ -2210,12 +2233,12 @@ meta_renderer_native_create_surface_egl_device (CoglOnscreen *onscreen, #endif /* HAVE_EGL_DEVICE */ static gboolean -init_dumb_fb (MetaDumbBuffer *dumb_fb, - MetaGpuKms *gpu_kms, - int width, - int height, - uint32_t format, - GError **error) +init_dumb_fb (MetaDumbBuffer *dumb_fb, + MetaGpuKms *gpu_kms, + int width, + int height, + uint32_t format, + GError **error) { struct drm_mode_create_dumb create_arg; struct drm_mode_destroy_dumb destroy_arg; @@ -2529,7 +2552,8 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen) } static const CoglWinsysEGLVtable -_cogl_winsys_egl_vtable = { + _cogl_winsys_egl_vtable = +{ .add_config_attributes = meta_renderer_native_add_egl_config_attributes, .choose_config = meta_renderer_native_choose_egl_config, .display_setup = meta_renderer_native_setup_egl_display, @@ -2589,14 +2613,14 @@ meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native) } static CoglOnscreen * -meta_renderer_native_create_onscreen (MetaRendererNative *renderer_native, - MetaGpuKms *render_gpu, - MetaLogicalMonitor *logical_monitor, - CoglContext *context, - MetaMonitorTransform transform, - gint view_width, - gint view_height, - GError **error) +meta_renderer_native_create_onscreen (MetaRendererNative *renderer_native, + MetaGpuKms *render_gpu, + MetaLogicalMonitor *logical_monitor, + CoglContext *context, + MetaMonitorTransform transform, + gint view_width, + gint view_height, + GError **error) { CoglOnscreen *onscreen; CoglOnscreenEGL *onscreen_egl; @@ -2657,12 +2681,12 @@ meta_renderer_native_create_onscreen (MetaRendererNative *renderer_native, } static CoglOffscreen * -meta_renderer_native_create_offscreen (MetaRendererNative *renderer, - CoglContext *context, - MetaMonitorTransform transform, - gint view_width, - gint view_height, - GError **error) +meta_renderer_native_create_offscreen (MetaRendererNative *renderer, + CoglContext *context, + MetaMonitorTransform transform, + gint view_width, + gint view_height, + GError **error) { CoglOffscreen *fb; CoglTexture2D *tex; @@ -2696,7 +2720,7 @@ get_native_cogl_winsys_vtable (CoglRenderer *cogl_renderer) if (!vtable_inited) { /* The this winsys is a subclass of the EGL winsys so we - start by copying its vtable */ + * start by copying its vtable */ parent_vtable = _cogl_winsys_egl_get_vtable (); vtable = *parent_vtable; @@ -2963,7 +2987,8 @@ create_secondary_egl_config (MetaEgl *egl, EGLConfig *egl_config, GError **error) { - EGLint attributes[] = { + EGLint attributes[] = + { EGL_RED_SIZE, 1, EGL_GREEN_SIZE, 1, EGL_BLUE_SIZE, 1, @@ -3002,7 +3027,8 @@ create_secondary_egl_context (MetaEgl *egl, EGLConfig egl_config, GError **error) { - EGLint attributes[] = { + EGLint attributes[] = + { EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE }; @@ -3041,7 +3067,8 @@ init_secondary_gpu_data_gpu (MetaRendererNativeGpuData *renderer_gpu_data, &egl_config, error)) return FALSE; - egl_context = create_secondary_egl_context (egl, egl_display, egl_config, error); + egl_context = create_secondary_egl_context (egl, egl_display, egl_config, + error); if (egl_context == EGL_NO_CONTEXT) return FALSE; @@ -3075,7 +3102,8 @@ init_secondary_gpu_data_gpu (MetaRendererNativeGpuData *renderer_gpu_data, renderer_gpu_data->secondary.egl_context = egl_context; renderer_gpu_data->secondary.egl_config = egl_config; - renderer_gpu_data->secondary.copy_mode = META_SHARED_FRAMEBUFFER_COPY_MODE_GPU; + renderer_gpu_data->secondary.copy_mode = + META_SHARED_FRAMEBUFFER_COPY_MODE_GPU; return TRUE; } @@ -3083,7 +3111,8 @@ init_secondary_gpu_data_gpu (MetaRendererNativeGpuData *renderer_gpu_data, static void init_secondary_gpu_data_cpu (MetaRendererNativeGpuData *renderer_gpu_data) { - renderer_gpu_data->secondary.copy_mode = META_SHARED_FRAMEBUFFER_COPY_MODE_CPU; + renderer_gpu_data->secondary.copy_mode = + META_SHARED_FRAMEBUFFER_COPY_MODE_CPU; } static void @@ -3094,17 +3123,18 @@ init_secondary_gpu_data (MetaRendererNativeGpuData *renderer_gpu_data) if (init_secondary_gpu_data_gpu (renderer_gpu_data, &error)) return; - g_warning ("Failed to initialize accelerated iGPU/dGPU framebuffer sharing: %s", - error->message); + g_warning ( + "Failed to initialize accelerated iGPU/dGPU framebuffer sharing: %s", + error->message); g_error_free (error); init_secondary_gpu_data_cpu (renderer_gpu_data); } static MetaRendererNativeGpuData * -create_renderer_gpu_data_gbm (MetaRendererNative *renderer_native, - MetaGpuKms *gpu_kms, - GError **error) +create_renderer_gpu_data_gbm (MetaRendererNative *renderer_native, + MetaGpuKms *gpu_kms, + GError **error) { MetaMonitorManagerKms *monitor_manager_kms; MetaEgl *egl = meta_renderer_native_get_egl (renderer_native); @@ -3187,9 +3217,9 @@ get_drm_device_file (MetaEgl *egl, } static EGLDeviceEXT -find_egl_device (MetaRendererNative *renderer_native, - MetaGpuKms *gpu_kms, - GError **error) +find_egl_device (MetaRendererNative *renderer_native, + MetaGpuKms *gpu_kms, + GError **error) { MetaEgl *egl = meta_renderer_native_get_egl (renderer_native); char **missing_extensions; @@ -3262,14 +3292,15 @@ find_egl_device (MetaRendererNative *renderer_native, } static EGLDisplay -get_egl_device_display (MetaRendererNative *renderer_native, - MetaGpuKms *gpu_kms, - EGLDeviceEXT egl_device, - GError **error) +get_egl_device_display (MetaRendererNative *renderer_native, + MetaGpuKms *gpu_kms, + EGLDeviceEXT egl_device, + GError **error) { MetaEgl *egl = meta_renderer_native_get_egl (renderer_native); int kms_fd = meta_gpu_kms_get_fd (gpu_kms); - EGLint platform_attribs[] = { + EGLint platform_attribs[] = + { EGL_DRM_MASTER_FD_EXT, kms_fd, EGL_NONE }; @@ -3281,9 +3312,9 @@ get_egl_device_display (MetaRendererNative *renderer_native, } static MetaRendererNativeGpuData * -create_renderer_gpu_data_egl_device (MetaRendererNative *renderer_native, - MetaGpuKms *gpu_kms, - GError **error) +create_renderer_gpu_data_egl_device (MetaRendererNative *renderer_native, + MetaGpuKms *gpu_kms, + GError **error) { MetaMonitorManagerKms *monitor_manager_kms = renderer_native->monitor_manager_kms; @@ -3294,7 +3325,7 @@ create_renderer_gpu_data_egl_device (MetaRendererNative *renderer_native, EGLDisplay egl_display; MetaRendererNativeGpuData *renderer_gpu_data; - if (!meta_is_stage_views_enabled()) + if (!meta_is_stage_views_enabled ()) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, @@ -3358,9 +3389,10 @@ create_renderer_gpu_data_egl_device (MetaRendererNative *renderer_native, #endif /* HAVE_EGL_DEVICE */ static MetaRendererNativeGpuData * -meta_renderer_native_create_renderer_gpu_data (MetaRendererNative *renderer_native, - MetaGpuKms *gpu_kms, - GError **error) +meta_renderer_native_create_renderer_gpu_data ( + MetaRendererNative *renderer_native, + MetaGpuKms *gpu_kms, + GError **error) { MetaRendererNativeGpuData *renderer_gpu_data; GError *gbm_error = NULL; @@ -3403,7 +3435,7 @@ meta_renderer_native_create_renderer_gpu_data (MetaRendererNative *renderer_nat #ifdef HAVE_EGL_DEVICE , egl_device_error->message #endif - ); + ); g_error_free (gbm_error); #ifdef HAVE_EGL_DEVICE @@ -3414,9 +3446,9 @@ meta_renderer_native_create_renderer_gpu_data (MetaRendererNative *renderer_nat } static gboolean -meta_renderer_native_initable_init (GInitable *initable, - GCancellable *cancellable, - GError **error) +meta_renderer_native_initable_init (GInitable *initable, + GCancellable *cancellable, + GError **error) { MetaRendererNative *renderer_native = META_RENDERER_NATIVE (initable); MetaMonitorManagerKms *monitor_manager_kms = @@ -3500,7 +3532,8 @@ meta_renderer_native_class_init (MetaRendererNativeClass *klass) object_class->finalize = meta_renderer_native_finalize; object_class->constructed = meta_renderer_native_constructed; - renderer_class->create_cogl_renderer = meta_renderer_native_create_cogl_renderer; + renderer_class->create_cogl_renderer = + meta_renderer_native_create_cogl_renderer; renderer_class->create_view = meta_renderer_native_create_view; obj_props[PROP_MONITOR_MANAGER] = diff --git a/src/backends/native/meta-stage-native.c b/src/backends/native/meta-stage-native.c index 2463781dc..94e6b79d0 100644 --- a/src/backends/native/meta-stage-native.c +++ b/src/backends/native/meta-stage-native.c @@ -32,7 +32,7 @@ #include "meta/meta-monitor-manager.h" #include "meta/util.h" -static GQuark quark_view_frame_closure = 0; +static GQuark quark_view_frame_closure = 0; struct _MetaStageNative { diff --git a/src/backends/x11/cm/meta-backend-x11-cm.c b/src/backends/x11/cm/meta-backend-x11-cm.c index 1e377220b..374608cf9 100644 --- a/src/backends/x11/cm/meta-backend-x11-cm.c +++ b/src/backends/x11/cm/meta-backend-x11-cm.c @@ -53,7 +53,10 @@ take_touch_grab (MetaBackend *backend) MetaBackendX11 *x11 = META_BACKEND_X11 (backend); Display *xdisplay = meta_backend_x11_get_xdisplay (x11); unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 }; - XIEventMask mask = { META_VIRTUAL_CORE_POINTER_ID, sizeof (mask_bits), mask_bits }; + XIEventMask mask = + { + META_VIRTUAL_CORE_POINTER_ID, sizeof (mask_bits), mask_bits + }; XIGrabModifiers mods = { XIAnyModifier, 0 }; XISetMask (mask.mask, XI_TouchBegin); @@ -154,12 +157,12 @@ meta_backend_x11_cm_select_stage_events (MetaBackend *backend) } static void -get_xkbrf_var_defs (Display *xdisplay, - const char *layouts, - const char *variants, - const char *options, - char **rules_p, - XkbRF_VarDefsRec *var_defs) +get_xkbrf_var_defs (Display *xdisplay, + const char *layouts, + const char *variants, + const char *options, + char **rules_p, + XkbRF_VarDefsRec *var_defs) { char *rules = NULL; @@ -182,7 +185,7 @@ get_xkbrf_var_defs (Display *xdisplay, var_defs->options = strdup (options); /* Sometimes, the property is a file path, and sometimes it's - not. Normalize it so it's always a file path. */ + * not. Normalize it so it's always a file path. */ if (rules[0] == '/') *rules_p = g_strdup (rules); else @@ -270,7 +273,8 @@ apply_keymap (MetaBackendX11 *x11) XkbComponentNamesRec xkb_comp_names = { 0 }; XkbRF_GetComponents (xkb_rules, &xkb_var_defs, &xkb_comp_names); - upload_xkb_description (xdisplay, rules_file_path, &xkb_var_defs, &xkb_comp_names); + upload_xkb_description (xdisplay, rules_file_path, &xkb_var_defs, + &xkb_comp_names); free_xkb_component_names (&xkb_comp_names); XkbRF_Free (xkb_rules, True); @@ -399,16 +403,21 @@ meta_backend_x11_cm_class_init (MetaBackendX11CmClass *klass) backend_class->post_init = meta_backend_x11_cm_post_init; backend_class->create_renderer = meta_backend_x11_cm_create_renderer; - backend_class->create_monitor_manager = meta_backend_x11_cm_create_monitor_manager; - backend_class->create_cursor_renderer = meta_backend_x11_cm_create_cursor_renderer; - backend_class->create_input_settings = meta_backend_x11_cm_create_input_settings; + backend_class->create_monitor_manager = + meta_backend_x11_cm_create_monitor_manager; + backend_class->create_cursor_renderer = + meta_backend_x11_cm_create_cursor_renderer; + backend_class->create_input_settings = + meta_backend_x11_cm_create_input_settings; backend_class->update_screen_size = meta_backend_x11_cm_update_screen_size; backend_class->select_stage_events = meta_backend_x11_cm_select_stage_events; backend_class->lock_layout_group = meta_backend_x11_cm_lock_layout_group; backend_class->set_keymap = meta_backend_x11_cm_set_keymap; - backend_x11_class->handle_host_xevent = meta_backend_x11_cm_handle_host_xevent; - backend_x11_class->translate_device_event = meta_backend_x11_cm_translate_device_event; - backend_x11_class->translate_crossing_event = meta_backend_x11_cm_translate_crossing_event; + backend_x11_class->handle_host_xevent = + meta_backend_x11_cm_handle_host_xevent; + backend_x11_class->translate_device_event = + meta_backend_x11_cm_translate_device_event; + backend_x11_class->translate_crossing_event = + meta_backend_x11_cm_translate_crossing_event; } - diff --git a/src/backends/x11/cm/meta-cursor-sprite-xfixes.c b/src/backends/x11/cm/meta-cursor-sprite-xfixes.c index 0c524668e..be98c5b6e 100644 --- a/src/backends/x11/cm/meta-cursor-sprite-xfixes.c +++ b/src/backends/x11/cm/meta-cursor-sprite-xfixes.c @@ -102,8 +102,8 @@ meta_cursor_sprite_xfixes_set_property (GObject *object, } MetaCursorSpriteXfixes * -meta_cursor_sprite_xfixes_new (MetaDisplay *display, - GError **error) +meta_cursor_sprite_xfixes_new (MetaDisplay *display, + GError **error) { return g_initable_new (META_TYPE_CURSOR_SPRITE_XFIXES, NULL, error, @@ -112,9 +112,9 @@ meta_cursor_sprite_xfixes_new (MetaDisplay *display, } static gboolean -meta_cursor_sprite_xfixes_initable_init (GInitable *initable, - GCancellable *cancellable, - GError **error) +meta_cursor_sprite_xfixes_initable_init (GInitable *initable, + GCancellable *cancellable, + GError **error) { MetaCursorSpriteXfixes *sprite_xfixes = META_CURSOR_SPRITE_XFIXES (initable); @@ -172,12 +172,12 @@ meta_cursor_sprite_xfixes_initable_init (GInitable *initable, clutter_backend = clutter_get_default_backend (); cogl_context = clutter_backend_get_cogl_context (clutter_backend); texture = cogl_texture_2d_new_from_data (cogl_context, - cursor_image->width, - cursor_image->height, - CLUTTER_CAIRO_FORMAT_ARGB32, - cursor_image->width * 4, /* stride */ - cursor_data, - error); + cursor_image->width, + cursor_image->height, + CLUTTER_CAIRO_FORMAT_ARGB32, + cursor_image->width * 4, /* stride */ + cursor_data, + error); if (free_cursor_data) g_free (cursor_data); diff --git a/src/backends/x11/meta-backend-x11.c b/src/backends/x11/meta-backend-x11.c index 99cc6180c..425aee3f0 100644 --- a/src/backends/x11/meta-backend-x11.c +++ b/src/backends/x11/meta-backend-x11.c @@ -329,7 +329,8 @@ handle_host_xevent (MetaBackend *backend, if (meta_plugin_manager_xevent_filter (compositor->plugin_mgr, event)) bypass_clutter = TRUE; - if (meta_dnd_handle_xdnd_event (backend, compositor, priv->xdisplay, event)) + if (meta_dnd_handle_xdnd_event (backend, compositor, priv->xdisplay, + event)) bypass_clutter = TRUE; } } @@ -383,7 +384,8 @@ handle_host_xevent (MetaBackend *backend, XFreeEventData (priv->xdisplay, &event->xcookie); } -typedef struct { +typedef struct +{ GSource base; GPollFD event_poll_fd; MetaBackend *backend; @@ -415,9 +417,9 @@ x_event_source_check (GSource *source) } static gboolean -x_event_source_dispatch (GSource *source, - GSourceFunc callback, - gpointer user_data) +x_event_source_dispatch (GSource *source, + GSourceFunc callback, + gpointer user_data) { XEventSource *x_source = (XEventSource *) source; MetaBackend *backend = x_source->backend; @@ -436,7 +438,8 @@ x_event_source_dispatch (GSource *source, return TRUE; } -static GSourceFuncs x_event_funcs = { +static GSourceFuncs x_event_funcs = +{ x_event_source_prepare, x_event_source_check, x_event_source_dispatch, @@ -482,7 +485,8 @@ meta_backend_x11_post_init (MetaBackend *backend) priv->source = x_event_source_new (backend); - if (!XSyncQueryExtension (priv->xdisplay, &priv->xsync_event_base, &priv->xsync_error_base) || + if (!XSyncQueryExtension (priv->xdisplay, &priv->xsync_event_base, + &priv->xsync_error_base) || !XSyncInitialize (priv->xdisplay, &major, &minor)) meta_fatal ("Could not initialize XSync"); @@ -498,7 +502,8 @@ meta_backend_x11_post_init (MetaBackend *backend) &priv->xinput_error_base, &priv->xinput_event_base)) { - major = 2; minor = 3; + major = 2; + minor = 3; if (XIQueryVersion (priv->xdisplay, &major, &minor) == Success) { int version = (major * 10) + minor; @@ -508,7 +513,8 @@ meta_backend_x11_post_init (MetaBackend *backend) } if (!has_xi) - meta_fatal ("X server doesn't have the XInput extension, version 2.2 or newer\n"); + meta_fatal ( + "X server doesn't have the XInput extension, version 2.2 or newer\n"); if (!xkb_x11_setup_xkb_extension (priv->xcb, XKB_X11_MIN_MAJOR_XKB_VERSION, @@ -517,8 +523,9 @@ meta_backend_x11_post_init (MetaBackend *backend) NULL, NULL, &priv->xkb_event_base, &priv->xkb_error_base)) - meta_fatal ("X server doesn't have the XKB extension, version %d.%d or newer\n", - XKB_X11_MIN_MAJOR_XKB_VERSION, XKB_X11_MIN_MINOR_XKB_VERSION); + meta_fatal ( + "X server doesn't have the XKB extension, version %d.%d or newer\n", + XKB_X11_MIN_MAJOR_XKB_VERSION, XKB_X11_MIN_MINOR_XKB_VERSION); META_BACKEND_CLASS (meta_backend_x11_parent_class)->post_init (backend); @@ -634,10 +641,12 @@ meta_backend_x11_get_keymap (MetaBackend *backend) struct xkb_context *context = xkb_context_new (XKB_CONTEXT_NO_FLAGS); priv->keymap = xkb_x11_keymap_new_from_device (context, priv->xcb, - xkb_x11_get_core_keyboard_device_id (priv->xcb), + xkb_x11_get_core_keyboard_device_id ( + priv->xcb), XKB_KEYMAP_COMPILE_NO_FLAGS); if (priv->keymap == NULL) - priv->keymap = xkb_keymap_new_from_names (context, NULL, XKB_KEYMAP_COMPILE_NO_FLAGS); + priv->keymap = xkb_keymap_new_from_names (context, NULL, + XKB_KEYMAP_COMPILE_NO_FLAGS); xkb_context_unref (context); } @@ -663,7 +672,7 @@ meta_backend_x11_set_numlock (MetaBackend *backend, void meta_backend_x11_handle_event (MetaBackendX11 *x11, - XEvent *xevent) + XEvent *xevent) { MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11); @@ -762,14 +771,17 @@ meta_backend_x11_class_init (MetaBackendX11Class *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = meta_backend_x11_finalize; - backend_class->create_clutter_backend = meta_backend_x11_create_clutter_backend; + backend_class->create_clutter_backend = + meta_backend_x11_create_clutter_backend; backend_class->post_init = meta_backend_x11_post_init; backend_class->grab_device = meta_backend_x11_grab_device; backend_class->ungrab_device = meta_backend_x11_ungrab_device; backend_class->warp_pointer = meta_backend_x11_warp_pointer; - backend_class->get_current_logical_monitor = meta_backend_x11_get_current_logical_monitor; + backend_class->get_current_logical_monitor = + meta_backend_x11_get_current_logical_monitor; backend_class->get_keymap = meta_backend_x11_get_keymap; - backend_class->get_keymap_layout_group = meta_backend_x11_get_keymap_layout_group; + backend_class->get_keymap_layout_group = + meta_backend_x11_get_keymap_layout_group; backend_class->set_numlock = meta_backend_x11_set_numlock; } @@ -780,7 +792,7 @@ meta_backend_x11_init (MetaBackendX11 *x11) * in Cogl - see meta_renderer_x11_create_cogl_renderer(). We call it here * to hopefully call it before any other use of XLib. */ - XInitThreads(); + XInitThreads (); /* We do X11 event retrieval ourselves */ clutter_x11_disable_event_retrieval (); diff --git a/src/backends/x11/meta-clutter-backend-x11.c b/src/backends/x11/meta-clutter-backend-x11.c index 56485ba9f..ba282b9da 100644 --- a/src/backends/x11/meta-clutter-backend-x11.c +++ b/src/backends/x11/meta-clutter-backend-x11.c @@ -44,8 +44,8 @@ G_DEFINE_TYPE (MetaClutterBackendX11, meta_clutter_backend_x11, CLUTTER_TYPE_BACKEND_X11) static CoglRenderer * -meta_clutter_backend_x11_get_renderer (ClutterBackend *clutter_backend, - GError **error) +meta_clutter_backend_x11_get_renderer (ClutterBackend * clutter_backend, + GError * *error) { MetaBackend *backend = meta_get_backend (); MetaRenderer *renderer = meta_backend_get_renderer (backend); @@ -54,9 +54,9 @@ meta_clutter_backend_x11_get_renderer (ClutterBackend *clutter_backend, } static ClutterStageWindow * -meta_clutter_backend_x11_create_stage (ClutterBackend *backend, - ClutterStage *wrapper, - GError **error) +meta_clutter_backend_x11_create_stage (ClutterBackend *backend, + ClutterStage *wrapper, + GError **error) { ClutterEventTranslator *translator; ClutterStageWindow *stage; @@ -65,12 +65,12 @@ meta_clutter_backend_x11_create_stage (ClutterBackend *backend, if (meta_is_wayland_compositor ()) stage_type = META_TYPE_STAGE_X11_NESTED; else - stage_type = CLUTTER_TYPE_STAGE_X11; + stage_type = CLUTTER_TYPE_STAGE_X11; stage = g_object_new (stage_type, - "backend", backend, - "wrapper", wrapper, - NULL); + "backend", backend, + "wrapper", wrapper, + NULL); /* the X11 stage does event translation */ translator = CLUTTER_EVENT_TRANSLATOR (stage); @@ -80,7 +80,7 @@ meta_clutter_backend_x11_create_stage (ClutterBackend *backend, } static void -meta_clutter_backend_x11_bell_notify (ClutterBackend *backend) +meta_clutter_backend_x11_bell_notify (ClutterBackend *backend) { MetaDisplay *display = meta_get_display (); diff --git a/src/backends/x11/meta-crtc-xrandr.c b/src/backends/x11/meta-crtc-xrandr.c index d201b8581..b14856bdb 100644 --- a/src/backends/x11/meta-crtc-xrandr.c +++ b/src/backends/x11/meta-crtc-xrandr.c @@ -103,7 +103,8 @@ meta_crtc_xrandr_set_config (MetaCrtc *crtc, static MetaMonitorTransform meta_monitor_transform_from_xrandr (Rotation rotation) { - static const MetaMonitorTransform y_reflected_map[4] = { + static const MetaMonitorTransform y_reflected_map[4] = + { META_MONITOR_TRANSFORM_FLIPPED_180, META_MONITOR_TRANSFORM_FLIPPED_90, META_MONITOR_TRANSFORM_FLIPPED, @@ -136,7 +137,8 @@ meta_monitor_transform_from_xrandr (Rotation rotation) return ret; } -#define ALL_ROTATIONS (RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270) +#define ALL_ROTATIONS (RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | \ + RR_Rotate_270) static MetaMonitorTransform meta_monitor_transform_from_xrandr_all (Rotation rotation) diff --git a/src/backends/x11/meta-cursor-renderer-x11.c b/src/backends/x11/meta-cursor-renderer-x11.c index 1f198c130..465ee6baf 100644 --- a/src/backends/x11/meta-cursor-renderer-x11.c +++ b/src/backends/x11/meta-cursor-renderer-x11.c @@ -38,14 +38,16 @@ struct _MetaCursorRendererX11Private }; typedef struct _MetaCursorRendererX11Private MetaCursorRendererX11Private; -G_DEFINE_TYPE_WITH_PRIVATE (MetaCursorRendererX11, meta_cursor_renderer_x11, META_TYPE_CURSOR_RENDERER); +G_DEFINE_TYPE_WITH_PRIVATE (MetaCursorRendererX11, meta_cursor_renderer_x11, + META_TYPE_CURSOR_RENDERER); static gboolean meta_cursor_renderer_x11_update_cursor (MetaCursorRenderer *renderer, MetaCursorSprite *cursor_sprite) { MetaCursorRendererX11 *x11 = META_CURSOR_RENDERER_X11 (renderer); - MetaCursorRendererX11Private *priv = meta_cursor_renderer_x11_get_instance_private (x11); + MetaCursorRendererX11Private *priv = + meta_cursor_renderer_x11_get_instance_private (x11); MetaBackendX11 *backend = META_BACKEND_X11 (meta_get_backend ()); Window xwindow = meta_backend_x11_get_xwindow (backend); @@ -107,7 +109,8 @@ meta_cursor_renderer_x11_class_init (MetaCursorRendererX11Class *klass) static void meta_cursor_renderer_x11_init (MetaCursorRendererX11 *x11) { - MetaCursorRendererX11Private *priv = meta_cursor_renderer_x11_get_instance_private (x11); + MetaCursorRendererX11Private *priv = + meta_cursor_renderer_x11_get_instance_private (x11); /* XFixes has no way to retrieve the current cursor visibility. */ priv->server_cursor_visible = TRUE; diff --git a/src/backends/x11/meta-gpu-xrandr.c b/src/backends/x11/meta-gpu-xrandr.c index 14b46d530..9dcdddf63 100644 --- a/src/backends/x11/meta-gpu-xrandr.c +++ b/src/backends/x11/meta-gpu-xrandr.c @@ -49,7 +49,7 @@ struct _MetaGpuXrandr G_DEFINE_TYPE (MetaGpuXrandr, meta_gpu_xrandr, META_TYPE_GPU) XRRScreenResources * -meta_gpu_xrandr_get_resources (MetaGpuXrandr *gpu_xrandr) +meta_gpu_xrandr_get_resources (MetaGpuXrandr * gpu_xrandr) { return gpu_xrandr->resources; } @@ -82,8 +82,8 @@ get_xmode_name (XRRModeInfo *xmode) } static gboolean -meta_gpu_xrandr_read_current (MetaGpu *gpu, - GError **error) +meta_gpu_xrandr_read_current (MetaGpu *gpu, + GError **error) { MetaGpuXrandr *gpu_xrandr = META_GPU_XRANDR (gpu); MetaMonitorManager *monitor_manager = meta_gpu_get_monitor_manager (gpu); @@ -163,7 +163,7 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu, modes = NULL; crtcs = NULL; - for (i = 0; i < (unsigned)resources->nmode; i++) + for (i = 0; i < (unsigned) resources->nmode; i++) { XRRModeInfo *xmode = &resources->modes[i]; MetaCrtcMode *mode; @@ -174,7 +174,7 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu, mode->width = xmode->width; mode->height = xmode->height; mode->refresh_rate = (xmode->dotClock / - ((float)xmode->hTotal * xmode->vTotal)); + ((float) xmode->hTotal * xmode->vTotal)); mode->flags = xmode->modeFlags; mode->name = get_xmode_name (xmode); @@ -182,7 +182,7 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu, } meta_gpu_take_modes (gpu, modes); - for (i = 0; i < (unsigned)resources->ncrtc; i++) + for (i = 0; i < (unsigned) resources->ncrtc; i++) { XRRCrtcInfo *xrandr_crtc; RRCrtc crtc_id; @@ -203,7 +203,7 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu, primary_output = XRRGetOutputPrimary (xdisplay, DefaultRootWindow (xdisplay)); - for (i = 0; i < (unsigned)resources->noutput; i++) + for (i = 0; i < (unsigned) resources->noutput; i++) { RROutput output_id; XRROutputInfo *xrandr_output; diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c index 2968ac859..1f69c152e 100644 --- a/src/backends/x11/meta-input-settings-x11.c +++ b/src/backends/x11/meta-input-settings-x11.c @@ -50,7 +50,8 @@ typedef struct _MetaInputSettingsX11Private G_DEFINE_TYPE_WITH_PRIVATE (MetaInputSettingsX11, meta_input_settings_x11, META_TYPE_INPUT_SETTINGS) -enum { +enum +{ SCROLL_METHOD_FIELD_2FG, SCROLL_METHOD_FIELD_EDGE, SCROLL_METHOD_FIELD_BUTTON, @@ -62,7 +63,8 @@ device_free_xdevice (gpointer user_data) { MetaDisplay *display = meta_get_display (); MetaBackend *backend = meta_get_backend (); - Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); + Display *xdisplay = + meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); XDevice *xdev = user_data; meta_x11_error_trap_push (display->x11_display); @@ -75,7 +77,8 @@ device_ensure_xdevice (ClutterInputDevice *device) { MetaDisplay *display = meta_get_display (); MetaBackend *backend = meta_get_backend (); - Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); + Display *xdisplay = + meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); int device_id = clutter_input_device_get_device_id (device); XDevice *xdev = NULL; @@ -105,7 +108,8 @@ get_property (ClutterInputDevice *device, gulong nitems) { MetaBackend *backend = meta_get_backend (); - Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); + Display *xdisplay = + meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); gulong nitems_ret, bytes_after_ret; int rc, device_id, format_ret; Atom property_atom, type_ret; @@ -120,11 +124,14 @@ get_property (ClutterInputDevice *device, rc = XIGetProperty (xdisplay, device_id, property_atom, 0, 10, False, type, &type_ret, &format_ret, &nitems_ret, &bytes_after_ret, &data_ret); - if (rc == Success && type_ret == type && format_ret == format && nitems_ret >= nitems) + if (rc == Success && type_ret == type && format_ret == format && + nitems_ret >= nitems) { if (nitems_ret > nitems) - g_warning ("Property '%s' for device '%s' returned %lu items, expected %lu", - property, clutter_input_device_get_device_name (device), nitems_ret, nitems); + g_warning ( + "Property '%s' for device '%s' returned %lu items, expected %lu", + property, clutter_input_device_get_device_name ( + device), nitems_ret, nitems); return data_ret; } @@ -141,7 +148,8 @@ change_property (ClutterInputDevice *device, gulong nitems) { MetaBackend *backend = meta_get_backend (); - Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); + Display *xdisplay = + meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); int device_id; Atom property_atom; guchar *data_ret; @@ -162,9 +170,9 @@ change_property (ClutterInputDevice *device, } static void -meta_input_settings_x11_set_send_events (MetaInputSettings *settings, - ClutterInputDevice *device, - GDesktopDeviceSendEvents mode) +meta_input_settings_x11_set_send_events (MetaInputSettings *settings, + ClutterInputDevice *device, + GDesktopDeviceSendEvents mode) { guchar values[2] = { 0 }; /* disabled, disabled-on-external-mouse */ guchar *available; @@ -202,10 +210,14 @@ meta_input_settings_x11_set_matrix (MetaInputSettings *settings, gfloat matrix[6]) { MetaBackend *backend = meta_get_backend (); - Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); - gfloat full_matrix[9] = { matrix[0], matrix[1], matrix[2], - matrix[3], matrix[4], matrix[5], - 0, 0, 1 }; + Display *xdisplay = + meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); + gfloat full_matrix[9] = + { + matrix[0], matrix[1], matrix[2], + matrix[3], matrix[4], matrix[5], + 0, 0, 1 + }; change_property (device, "Coordinate Transformation Matrix", XInternAtom (xdisplay, "FLOAT", False), @@ -218,7 +230,8 @@ meta_input_settings_x11_set_speed (MetaInputSettings *settings, gdouble speed) { MetaBackend *backend = meta_get_backend (); - Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); + Display *xdisplay = + meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); gfloat value = speed; change_property (device, "libinput Accel Speed", @@ -297,11 +310,12 @@ meta_input_settings_x11_set_invert_scroll (MetaInputSettings *settings, } static void -meta_input_settings_x11_set_edge_scroll (MetaInputSettings *settings, - ClutterInputDevice *device, - gboolean edge_scroll_enabled) +meta_input_settings_x11_set_edge_scroll (MetaInputSettings *settings, + ClutterInputDevice *device, + gboolean edge_scroll_enabled) { - guchar values[SCROLL_METHOD_NUM_FIELDS] = { 0 }; /* 2fg, edge, button. The last value is unused */ + guchar values[SCROLL_METHOD_NUM_FIELDS] = { 0 }; /* 2fg, edge, button. The + * last value is unused */ guchar *current = NULL; guchar *available = NULL; @@ -320,17 +334,18 @@ meta_input_settings_x11_set_edge_scroll (MetaInputSettings *settings, values[SCROLL_METHOD_FIELD_EDGE] = !!edge_scroll_enabled; change_property (device, "libinput Scroll Method Enabled", XA_INTEGER, 8, &values, SCROLL_METHOD_NUM_FIELDS); - out: +out: meta_XFree (current); meta_XFree (available); } static void -meta_input_settings_x11_set_two_finger_scroll (MetaInputSettings *settings, - ClutterInputDevice *device, - gboolean two_finger_scroll_enabled) +meta_input_settings_x11_set_two_finger_scroll (MetaInputSettings *settings, + ClutterInputDevice *device, + gboolean two_finger_scroll_enabled) { - guchar values[SCROLL_METHOD_NUM_FIELDS] = { 0 }; /* 2fg, edge, button. The last value is unused */ + guchar values[SCROLL_METHOD_NUM_FIELDS] = { 0 }; /* 2fg, edge, button. The + * last value is unused */ guchar *current = NULL; guchar *available = NULL; @@ -349,7 +364,7 @@ meta_input_settings_x11_set_two_finger_scroll (MetaInputSettings *set values[SCROLL_METHOD_FIELD_2FG] = !!two_finger_scroll_enabled; change_property (device, "libinput Scroll Method Enabled", XA_INTEGER, 8, &values, SCROLL_METHOD_NUM_FIELDS); - out: +out: meta_XFree (current); meta_XFree (available); } @@ -380,9 +395,9 @@ meta_input_settings_x11_set_scroll_button (MetaInputSettings *settings, } static void -meta_input_settings_x11_set_click_method (MetaInputSettings *settings, - ClutterInputDevice *device, - GDesktopTouchpadClickMethod mode) +meta_input_settings_x11_set_click_method (MetaInputSettings *settings, + ClutterInputDevice *device, + GDesktopTouchpadClickMethod mode) { guchar values[2] = { 0 }; /* buttonareas, clickfinger */ guchar *defaults, *available; @@ -413,7 +428,7 @@ meta_input_settings_x11_set_click_method (MetaInputSettings *settings, default: g_assert_not_reached (); return; - } + } if ((values[0] && !available[0]) || (values[1] && !available[1])) g_warning ("Device '%s' does not support click method %d\n", @@ -422,7 +437,7 @@ meta_input_settings_x11_set_click_method (MetaInputSettings *settings, change_property (device, "libinput Click Method Enabled", XA_INTEGER, 8, &values, 2); - meta_XFree(available); + meta_XFree (available); } static void @@ -432,7 +447,8 @@ meta_input_settings_x11_set_keyboard_repeat (MetaInputSettings *settings, guint interval) { MetaBackend *backend = meta_get_backend (); - Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); + Display *xdisplay = + meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); if (enabled) { @@ -521,7 +537,7 @@ set_device_accel_profile (ClutterInputDevice *device, return; available = get_property (device, "libinput Accel Profiles Available", - XA_INTEGER, 8, 2); + XA_INTEGER, 8, 2); if (!available) goto err_available; @@ -553,9 +569,10 @@ err_available: } static void -meta_input_settings_x11_set_mouse_accel_profile (MetaInputSettings *settings, - ClutterInputDevice *device, - GDesktopPointerAccelProfile profile) +meta_input_settings_x11_set_mouse_accel_profile ( + MetaInputSettings *settings, + ClutterInputDevice *device, + GDesktopPointerAccelProfile profile) { if (!is_mouse (settings, device)) return; @@ -564,9 +581,10 @@ meta_input_settings_x11_set_mouse_accel_profile (MetaInputSettings *set } static void -meta_input_settings_x11_set_trackball_accel_profile (MetaInputSettings *settings, - ClutterInputDevice *device, - GDesktopPointerAccelProfile profile) +meta_input_settings_x11_set_trackball_accel_profile ( + MetaInputSettings *settings, + ClutterInputDevice *device, + GDesktopPointerAccelProfile profile) { if (!meta_input_settings_x11_is_trackball_device (settings, device)) return; @@ -575,13 +593,14 @@ meta_input_settings_x11_set_trackball_accel_profile (MetaInputSettings } static void -meta_input_settings_x11_set_tablet_mapping (MetaInputSettings *settings, - ClutterInputDevice *device, - GDesktopTabletMapping mapping) +meta_input_settings_x11_set_tablet_mapping (MetaInputSettings *settings, + ClutterInputDevice *device, + GDesktopTabletMapping mapping) { MetaDisplay *display = meta_get_display (); MetaBackend *backend = meta_get_backend (); - Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); + Display *xdisplay = + meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); XDevice *xdev; if (!display) @@ -607,8 +626,8 @@ meta_input_settings_x11_set_tablet_mapping (MetaInputSettings *settings, ClutterInputDeviceMapping dev_mapping; dev_mapping = (mapping == G_DESKTOP_TABLET_MAPPING_ABSOLUTE) ? - CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE : - CLUTTER_INPUT_DEVICE_MAPPING_RELATIVE; + CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE : + CLUTTER_INPUT_DEVICE_MAPPING_RELATIVE; clutter_input_device_set_mapping_mode (device, dev_mapping); } } @@ -621,7 +640,8 @@ device_query_area (ClutterInputDevice *device, gint *height) { MetaBackend *backend = meta_get_backend (); - Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); + Display *xdisplay = + meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); gint device_id, n_devices, i; XIDeviceInfo *info; Atom abs_x, abs_y; @@ -768,16 +788,18 @@ action_to_button (GDesktopStylusButtonAction action, } static void -meta_input_settings_x11_set_stylus_button_map (MetaInputSettings *settings, - ClutterInputDevice *device, - ClutterInputDeviceTool *tool, - GDesktopStylusButtonAction primary, - GDesktopStylusButtonAction secondary, - GDesktopStylusButtonAction tertiary) +meta_input_settings_x11_set_stylus_button_map ( + MetaInputSettings *settings, + ClutterInputDevice *device, + ClutterInputDeviceTool *tool, + GDesktopStylusButtonAction primary, + GDesktopStylusButtonAction secondary, + GDesktopStylusButtonAction tertiary) { MetaDisplay *display = meta_get_display (); MetaBackend *backend = meta_get_backend (); - Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); + Display *xdisplay = + meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); XDevice *xdev; if (!display) @@ -788,7 +810,8 @@ meta_input_settings_x11_set_stylus_button_map (MetaInputSettings *setti xdev = device_ensure_xdevice (device); if (xdev) { - guchar map[8] = { + guchar map[8] = + { CLUTTER_BUTTON_PRIMARY, action_to_button (primary, CLUTTER_BUTTON_MIDDLE), action_to_button (secondary, CLUTTER_BUTTON_SECONDARY), @@ -825,36 +848,57 @@ static void meta_input_settings_x11_class_init (MetaInputSettingsX11Class *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - MetaInputSettingsClass *input_settings_class = META_INPUT_SETTINGS_CLASS (klass); + MetaInputSettingsClass *input_settings_class = META_INPUT_SETTINGS_CLASS ( + klass); object_class->dispose = meta_input_settings_x11_dispose; - input_settings_class->set_send_events = meta_input_settings_x11_set_send_events; + input_settings_class->set_send_events = + meta_input_settings_x11_set_send_events; input_settings_class->set_matrix = meta_input_settings_x11_set_matrix; input_settings_class->set_speed = meta_input_settings_x11_set_speed; - input_settings_class->set_left_handed = meta_input_settings_x11_set_left_handed; - input_settings_class->set_tap_enabled = meta_input_settings_x11_set_tap_enabled; - input_settings_class->set_tap_and_drag_enabled = meta_input_settings_x11_set_tap_and_drag_enabled; - input_settings_class->set_disable_while_typing = meta_input_settings_x11_set_disable_while_typing; - input_settings_class->set_invert_scroll = meta_input_settings_x11_set_invert_scroll; - input_settings_class->set_edge_scroll = meta_input_settings_x11_set_edge_scroll; - input_settings_class->set_two_finger_scroll = meta_input_settings_x11_set_two_finger_scroll; - input_settings_class->set_scroll_button = meta_input_settings_x11_set_scroll_button; - input_settings_class->set_click_method = meta_input_settings_x11_set_click_method; - input_settings_class->set_keyboard_repeat = meta_input_settings_x11_set_keyboard_repeat; - - input_settings_class->set_tablet_mapping = meta_input_settings_x11_set_tablet_mapping; - input_settings_class->set_tablet_keep_aspect = meta_input_settings_x11_set_tablet_keep_aspect; - input_settings_class->set_tablet_area = meta_input_settings_x11_set_tablet_area; - - input_settings_class->set_mouse_accel_profile = meta_input_settings_x11_set_mouse_accel_profile; - input_settings_class->set_trackball_accel_profile = meta_input_settings_x11_set_trackball_accel_profile; - - input_settings_class->set_stylus_pressure = meta_input_settings_x11_set_stylus_pressure; - input_settings_class->set_stylus_button_map = meta_input_settings_x11_set_stylus_button_map; - - input_settings_class->has_two_finger_scroll = meta_input_settings_x11_has_two_finger_scroll; - input_settings_class->is_trackball_device = meta_input_settings_x11_is_trackball_device; + input_settings_class->set_left_handed = + meta_input_settings_x11_set_left_handed; + input_settings_class->set_tap_enabled = + meta_input_settings_x11_set_tap_enabled; + input_settings_class->set_tap_and_drag_enabled = + meta_input_settings_x11_set_tap_and_drag_enabled; + input_settings_class->set_disable_while_typing = + meta_input_settings_x11_set_disable_while_typing; + input_settings_class->set_invert_scroll = + meta_input_settings_x11_set_invert_scroll; + input_settings_class->set_edge_scroll = + meta_input_settings_x11_set_edge_scroll; + input_settings_class->set_two_finger_scroll = + meta_input_settings_x11_set_two_finger_scroll; + input_settings_class->set_scroll_button = + meta_input_settings_x11_set_scroll_button; + input_settings_class->set_click_method = + meta_input_settings_x11_set_click_method; + input_settings_class->set_keyboard_repeat = + meta_input_settings_x11_set_keyboard_repeat; + + input_settings_class->set_tablet_mapping = + meta_input_settings_x11_set_tablet_mapping; + input_settings_class->set_tablet_keep_aspect = + meta_input_settings_x11_set_tablet_keep_aspect; + input_settings_class->set_tablet_area = + meta_input_settings_x11_set_tablet_area; + + input_settings_class->set_mouse_accel_profile = + meta_input_settings_x11_set_mouse_accel_profile; + input_settings_class->set_trackball_accel_profile = + meta_input_settings_x11_set_trackball_accel_profile; + + input_settings_class->set_stylus_pressure = + meta_input_settings_x11_set_stylus_pressure; + input_settings_class->set_stylus_button_map = + meta_input_settings_x11_set_stylus_button_map; + + input_settings_class->has_two_finger_scroll = + meta_input_settings_x11_has_two_finger_scroll; + input_settings_class->is_trackball_device = + meta_input_settings_x11_is_trackball_device; } static void diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c index 21ee50e97..58f2e584d 100644 --- a/src/backends/x11/meta-monitor-manager-xrandr.c +++ b/src/backends/x11/meta-monitor-manager-xrandr.c @@ -81,7 +81,8 @@ struct _MetaMonitorManagerXrandrClass MetaMonitorManagerClass parent_class; }; -G_DEFINE_TYPE (MetaMonitorManagerXrandr, meta_monitor_manager_xrandr, META_TYPE_MONITOR_MANAGER); +G_DEFINE_TYPE (MetaMonitorManagerXrandr, meta_monitor_manager_xrandr, + META_TYPE_MONITOR_MANAGER); typedef struct _MetaMonitorXrandrData { @@ -91,13 +92,15 @@ typedef struct _MetaMonitorXrandrData GQuark quark_meta_monitor_xrandr_data; Display * -meta_monitor_manager_xrandr_get_xdisplay (MetaMonitorManagerXrandr *manager_xrandr) +meta_monitor_manager_xrandr_get_xdisplay ( + MetaMonitorManagerXrandr *manager_xrandr) { return manager_xrandr->xdisplay; } gboolean -meta_monitor_manager_xrandr_has_randr15 (MetaMonitorManagerXrandr *manager_xrandr) +meta_monitor_manager_xrandr_has_randr15 ( + MetaMonitorManagerXrandr *manager_xrandr) { return manager_xrandr->has_randr15; } @@ -111,27 +114,29 @@ meta_monitor_manager_xrandr_read_edid (MetaMonitorManager *manager, static void meta_monitor_manager_xrandr_set_power_save_mode (MetaMonitorManager *manager, - MetaPowerSave mode) + MetaPowerSave mode) { - MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager); + MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR ( + manager); CARD16 state; - switch (mode) { - case META_POWER_SAVE_ON: - state = DPMSModeOn; - break; - case META_POWER_SAVE_STANDBY: - state = DPMSModeStandby; - break; - case META_POWER_SAVE_SUSPEND: - state = DPMSModeSuspend; - break; - case META_POWER_SAVE_OFF: - state = DPMSModeOff; - break; - default: - return; - } + switch (mode) + { + case META_POWER_SAVE_ON: + state = DPMSModeOn; + break; + case META_POWER_SAVE_STANDBY: + state = DPMSModeStandby; + break; + case META_POWER_SAVE_SUSPEND: + state = DPMSModeSuspend; + break; + case META_POWER_SAVE_OFF: + state = DPMSModeOff; + break; + default: + return; + } DPMSForceLevel (manager_xrandr->xdisplay, state); DPMSSetTimeouts (manager_xrandr->xdisplay, 0, 0, 0); @@ -219,7 +224,7 @@ is_crtc_assignment_changed (MetaCrtc *crtc, for (j = 0; j < crtc_info->outputs->len; j++) { - MetaOutput *output = ((MetaOutput**) crtc_info->outputs->pdata)[j]; + MetaOutput *output = ((MetaOutput **) crtc_info->outputs->pdata)[j]; MetaCrtc *assigned_crtc; assigned_crtc = meta_output_get_assigned_crtc (output); @@ -276,7 +281,7 @@ is_output_assignment_changed (MetaOutput *output, for (j = 0; j < crtc_info->outputs->len; j++) { MetaOutput *crtc_info_output = - ((MetaOutput**) crtc_info->outputs->pdata)[j]; + ((MetaOutput **) crtc_info->outputs->pdata)[j]; if (crtc_info_output == output && crtc_info->crtc == assigned_crtc) @@ -329,7 +334,8 @@ apply_crtc_assignments (MetaMonitorManager *manager, MetaOutputInfo **outputs, unsigned int n_outputs) { - MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager); + MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR ( + manager); unsigned i; GList *l; int width, height, width_mm, height_mm; @@ -337,7 +343,8 @@ apply_crtc_assignments (MetaMonitorManager *manager, XGrabServer (manager_xrandr->xdisplay); /* First compute the new size of the screen (framebuffer) */ - width = 0; height = 0; + width = 0; + height = 0; for (i = 0; i < n_crtcs; i++) { MetaCrtcInfo *crtc_info = crtcs[i]; @@ -360,10 +367,10 @@ apply_crtc_assignments (MetaMonitorManager *manager, } /* Second disable all newly disabled CRTCs, or CRTCs that in the previous - configuration would be outside the new framebuffer (otherwise X complains - loudly when resizing) - CRTC will be enabled again after resizing the FB - */ + * configuration would be outside the new framebuffer (otherwise X complains + * loudly when resizing) + * CRTC will be enabled again after resizing the FB + */ for (i = 0; i < n_crtcs; i++) { MetaCrtcInfo *crtc_info = crtcs[i]; @@ -428,7 +435,8 @@ apply_crtc_assignments (MetaMonitorManager *manager, */ width_mm = (width / DPI_FALLBACK) * 25.4 + 0.5; height_mm = (height / DPI_FALLBACK) * 25.4 + 0.5; - XRRSetScreenSize (manager_xrandr->xdisplay, DefaultRootWindow (manager_xrandr->xdisplay), + XRRSetScreenSize (manager_xrandr->xdisplay, + DefaultRootWindow (manager_xrandr->xdisplay), width, height, width_mm, height_mm); for (i = 0; i < n_crtcs; i++) @@ -452,7 +460,7 @@ apply_crtc_assignments (MetaMonitorManager *manager, { MetaOutput *output; - output = ((MetaOutput**)crtc_info->outputs->pdata)[j]; + output = ((MetaOutput **) crtc_info->outputs->pdata)[j]; output->is_dirty = TRUE; meta_output_assign_crtc (output, crtc); @@ -471,10 +479,12 @@ apply_crtc_assignments (MetaMonitorManager *manager, rotation, output_ids, n_output_ids)) { - meta_warning ("Configuring CRTC %d with mode %d (%d x %d @ %f) at position %d, %d and transform %u failed\n", - (unsigned)(crtc->crtc_id), (unsigned)(mode->mode_id), - mode->width, mode->height, (float)mode->refresh_rate, - crtc_info->x, crtc_info->y, crtc_info->transform); + meta_warning ( + "Configuring CRTC %d with mode %d (%d x %d @ %f) at position %d, %d and transform %u failed\n", + (unsigned) (crtc->crtc_id), + (unsigned) (mode->mode_id), + mode->width, mode->height, (float) mode->refresh_rate, + crtc_info->x, crtc_info->y, crtc_info->transform); continue; } @@ -561,10 +571,11 @@ meta_monitor_manager_xrandr_rebuild_derived (MetaMonitorManager *manager, } static gboolean -meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager *manager, - MetaMonitorsConfig *config, - MetaMonitorsConfigMethod method, - GError **error) +meta_monitor_manager_xrandr_apply_monitors_config ( + MetaMonitorManager *manager, + MetaMonitorsConfig *config, + MetaMonitorsConfigMethod method, + GError **error) { GPtrArray *crtc_infos; GPtrArray *output_infos; @@ -617,24 +628,25 @@ meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager *mana static void meta_monitor_manager_xrandr_change_backlight (MetaMonitorManager *manager, - MetaOutput *output, - gint value) + MetaOutput *output, + gint value) { meta_output_xrandr_change_backlight (output, value); } static void -meta_monitor_manager_xrandr_get_crtc_gamma (MetaMonitorManager *manager, - MetaCrtc *crtc, - gsize *size, - unsigned short **red, - unsigned short **green, - unsigned short **blue) +meta_monitor_manager_xrandr_get_crtc_gamma (MetaMonitorManager *manager, + MetaCrtc *crtc, + gsize *size, + unsigned short **red, + unsigned short **green, + unsigned short **blue) { - MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager); + MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR ( + manager); XRRCrtcGamma *gamma; - gamma = XRRGetCrtcGamma (manager_xrandr->xdisplay, (XID)crtc->crtc_id); + gamma = XRRGetCrtcGamma (manager_xrandr->xdisplay, (XID) crtc->crtc_id); *size = gamma->size; *red = g_memdup (gamma->red, sizeof (unsigned short) * gamma->size); @@ -646,13 +658,14 @@ meta_monitor_manager_xrandr_get_crtc_gamma (MetaMonitorManager *manager, static void meta_monitor_manager_xrandr_set_crtc_gamma (MetaMonitorManager *manager, - MetaCrtc *crtc, - gsize size, - unsigned short *red, - unsigned short *green, - unsigned short *blue) + MetaCrtc *crtc, + gsize size, + unsigned short *red, + unsigned short *green, + unsigned short *blue) { - MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager); + MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR ( + manager); XRRCrtcGamma *gamma; gamma = XRRAllocGamma (size); @@ -660,7 +673,7 @@ meta_monitor_manager_xrandr_set_crtc_gamma (MetaMonitorManager *manager, memcpy (gamma->green, green, sizeof (unsigned short) * size); memcpy (gamma->blue, blue, sizeof (unsigned short) * size); - XRRSetCrtcGamma (manager_xrandr->xdisplay, (XID)crtc->crtc_id, gamma); + XRRSetCrtcGamma (manager_xrandr->xdisplay, (XID) crtc->crtc_id, gamma); XRRFreeGamma (gamma); } @@ -685,8 +698,9 @@ meta_monitor_xrandr_data_from_monitor (MetaMonitor *monitor) } static void -meta_monitor_manager_xrandr_increase_monitor_count (MetaMonitorManagerXrandr *manager_xrandr, - Atom name_atom) +meta_monitor_manager_xrandr_increase_monitor_count ( + MetaMonitorManagerXrandr *manager_xrandr, + Atom name_atom) { int count; @@ -701,8 +715,9 @@ meta_monitor_manager_xrandr_increase_monitor_count (MetaMonitorManagerXrandr *ma } static int -meta_monitor_manager_xrandr_decrease_monitor_count (MetaMonitorManagerXrandr *manager_xrandr, - Atom name_atom) +meta_monitor_manager_xrandr_decrease_monitor_count ( + MetaMonitorManagerXrandr *manager_xrandr, + Atom name_atom) { int count; @@ -723,7 +738,8 @@ static void meta_monitor_manager_xrandr_tiled_monitor_added (MetaMonitorManager *manager, MetaMonitor *monitor) { - MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager); + MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR ( + manager); MetaMonitorTiled *monitor_tiled = META_MONITOR_TILED (monitor); const char *product; char *name; @@ -778,7 +794,8 @@ static void meta_monitor_manager_xrandr_tiled_monitor_removed (MetaMonitorManager *manager, MetaMonitor *monitor) { - MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager); + MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR ( + manager); MetaMonitorXrandrData *monitor_xrandr_data; Atom monitor_name; @@ -800,7 +817,8 @@ meta_monitor_manager_xrandr_tiled_monitor_removed (MetaMonitorManager *manager, } static void -meta_monitor_manager_xrandr_init_monitors (MetaMonitorManagerXrandr *manager_xrandr) +meta_monitor_manager_xrandr_init_monitors ( + MetaMonitorManagerXrandr *manager_xrandr) { XRRMonitorInfo *m; int n, i; @@ -809,7 +827,7 @@ meta_monitor_manager_xrandr_init_monitors (MetaMonitorManagerXrandr *manager_xra return; /* delete any tiled monitors setup, as mutter will want to recreate - things in its image */ + * things in its image */ m = XRRGetMonitors (manager_xrandr->xdisplay, DefaultRootWindow (manager_xrandr->xdisplay), FALSE, &n); @@ -837,9 +855,10 @@ meta_monitor_manager_xrandr_is_transform_handled (MetaMonitorManager *manager, } static float -meta_monitor_manager_xrandr_calculate_monitor_mode_scale (MetaMonitorManager *manager, - MetaMonitor *monitor, - MetaMonitorMode *monitor_mode) +meta_monitor_manager_xrandr_calculate_monitor_mode_scale ( + MetaMonitorManager *manager, + MetaMonitor *monitor, + MetaMonitorMode *monitor_mode) { return meta_monitor_calculate_mode_scale (monitor, monitor_mode); } @@ -916,11 +935,12 @@ ensure_supported_monitor_scales (MetaMonitorManager *manager) } static float * -meta_monitor_manager_xrandr_calculate_supported_scales (MetaMonitorManager *manager, - MetaLogicalMonitorLayoutMode layout_mode, - MetaMonitor *monitor, - MetaMonitorMode *monitor_mode, - int *n_supported_scales) +meta_monitor_manager_xrandr_calculate_supported_scales ( + MetaMonitorManager *manager, + MetaLogicalMonitorLayoutMode layout_mode, + MetaMonitor *monitor, + MetaMonitorMode *monitor_mode, + int *n_supported_scales) { MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager); @@ -974,8 +994,8 @@ meta_monitor_manager_xrandr_constructed (GObject *object) meta_monitor_manager_add_gpu (manager, manager_xrandr->gpu); if (!XRRQueryExtension (manager_xrandr->xdisplay, - &manager_xrandr->rr_event_base, - &manager_xrandr->rr_error_base)) + &manager_xrandr->rr_event_base, + &manager_xrandr->rr_error_base)) { return; } @@ -983,12 +1003,12 @@ meta_monitor_manager_xrandr_constructed (GObject *object) { int major_version, minor_version; /* We only use ScreenChangeNotify, but GDK uses the others, - and we don't want to step on its toes */ + * and we don't want to step on its toes */ XRRSelectInput (manager_xrandr->xdisplay, - DefaultRootWindow (manager_xrandr->xdisplay), - RRScreenChangeNotifyMask - | RRCrtcChangeNotifyMask - | RROutputPropertyNotifyMask); + DefaultRootWindow (manager_xrandr->xdisplay), + RRScreenChangeNotifyMask + | RRCrtcChangeNotifyMask + | RROutputPropertyNotifyMask); manager_xrandr->has_randr15 = FALSE; XRRQueryVersion (manager_xrandr->xdisplay, &major_version, @@ -1009,7 +1029,8 @@ meta_monitor_manager_xrandr_constructed (GObject *object) static void meta_monitor_manager_xrandr_finalize (GObject *object) { - MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (object); + MetaMonitorManagerXrandr *manager_xrandr = + META_MONITOR_MANAGER_XRANDR (object); g_clear_object (&manager_xrandr->gpu); g_hash_table_destroy (manager_xrandr->tiled_monitor_atoms); @@ -1033,28 +1054,41 @@ meta_monitor_manager_xrandr_class_init (MetaMonitorManagerXrandrClass *klass) object_class->constructed = meta_monitor_manager_xrandr_constructed; manager_class->read_edid = meta_monitor_manager_xrandr_read_edid; - manager_class->ensure_initial_config = meta_monitor_manager_xrandr_ensure_initial_config; - manager_class->apply_monitors_config = meta_monitor_manager_xrandr_apply_monitors_config; - manager_class->set_power_save_mode = meta_monitor_manager_xrandr_set_power_save_mode; - manager_class->change_backlight = meta_monitor_manager_xrandr_change_backlight; + manager_class->ensure_initial_config = + meta_monitor_manager_xrandr_ensure_initial_config; + manager_class->apply_monitors_config = + meta_monitor_manager_xrandr_apply_monitors_config; + manager_class->set_power_save_mode = + meta_monitor_manager_xrandr_set_power_save_mode; + manager_class->change_backlight = + meta_monitor_manager_xrandr_change_backlight; manager_class->get_crtc_gamma = meta_monitor_manager_xrandr_get_crtc_gamma; manager_class->set_crtc_gamma = meta_monitor_manager_xrandr_set_crtc_gamma; - manager_class->tiled_monitor_added = meta_monitor_manager_xrandr_tiled_monitor_added; - manager_class->tiled_monitor_removed = meta_monitor_manager_xrandr_tiled_monitor_removed; - 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->calculate_supported_scales = meta_monitor_manager_xrandr_calculate_supported_scales; - manager_class->get_capabilities = meta_monitor_manager_xrandr_get_capabilities; - manager_class->get_max_screen_size = meta_monitor_manager_xrandr_get_max_screen_size; - manager_class->get_default_layout_mode = meta_monitor_manager_xrandr_get_default_layout_mode; + manager_class->tiled_monitor_added = + meta_monitor_manager_xrandr_tiled_monitor_added; + manager_class->tiled_monitor_removed = + meta_monitor_manager_xrandr_tiled_monitor_removed; + 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->calculate_supported_scales = + meta_monitor_manager_xrandr_calculate_supported_scales; + manager_class->get_capabilities = + meta_monitor_manager_xrandr_get_capabilities; + manager_class->get_max_screen_size = + meta_monitor_manager_xrandr_get_max_screen_size; + manager_class->get_default_layout_mode = + meta_monitor_manager_xrandr_get_default_layout_mode; quark_meta_monitor_xrandr_data = g_quark_from_static_string ("-meta-monitor-xrandr-data"); } gboolean -meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xrandr, - XEvent *event) +meta_monitor_manager_xrandr_handle_xevent ( + MetaMonitorManagerXrandr *manager_xrandr, + XEvent *event) { MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_xrandr); MetaGpuXrandr *gpu_xrandr; diff --git a/src/backends/x11/meta-output-xrandr.c b/src/backends/x11/meta-output-xrandr.c index 515389dae..eecf7b530 100644 --- a/src/backends/x11/meta-output-xrandr.c +++ b/src/backends/x11/meta-output-xrandr.c @@ -143,7 +143,7 @@ static int normalize_backlight (MetaOutput *output, int hw_value) { - return round ((double)(hw_value - output->backlight_min) / + return round ((double) (hw_value - output->backlight_min) / (output->backlight_max - output->backlight_min) * 100.0); } @@ -161,12 +161,13 @@ meta_output_xrandr_change_backlight (MetaOutput *output, atom = XInternAtom (xdisplay, "Backlight", False); xcb_randr_change_output_property (XGetXCBConnection (xdisplay), - (XID)output->winsys_id, + (XID) output->winsys_id, atom, XCB_ATOM_INTEGER, 32, XCB_PROP_MODE_REPLACE, 1, &hw_value); - /* We're not selecting for property notifies, so update the value immediately */ + /* We're not selecting for property notifies, so update the value immediately + * */ output->backlight = normalize_backlight (output, hw_value); } @@ -184,7 +185,7 @@ output_get_integer_property (MetaOutput *output, atom = XInternAtom (xdisplay, propname, False); XRRGetOutputProperty (xdisplay, - (XID)output->winsys_id, + (XID) output->winsys_id, atom, 0, G_MAXLONG, False, False, XA_INTEGER, &actual_type, &actual_format, @@ -193,7 +194,7 @@ output_get_integer_property (MetaOutput *output, exists = (actual_type == XA_INTEGER && actual_format == 32 && nitems == 1); if (exists && value != NULL) - *value = ((int*)buffer)[0]; + *value = ((int *) buffer)[0]; XFree (buffer); return exists; @@ -212,7 +213,7 @@ output_get_property_exists (MetaOutput *output, atom = XInternAtom (xdisplay, propname, False); XRRGetOutputProperty (xdisplay, - (XID)output->winsys_id, + (XID) output->winsys_id, atom, 0, G_MAXLONG, False, False, AnyPropertyType, &actual_type, &actual_format, @@ -236,7 +237,7 @@ output_get_boolean_property (MetaOutput *output, atom = XInternAtom (xdisplay, propname, False); XRRGetOutputProperty (xdisplay, - (XID)output->winsys_id, + (XID) output->winsys_id, atom, 0, G_MAXLONG, False, False, XA_CARDINAL, &actual_type, &actual_format, @@ -245,7 +246,7 @@ output_get_boolean_property (MetaOutput *output, if (actual_type != XA_CARDINAL || actual_format != 32 || nitems < 1) return FALSE; - return ((int*)buffer)[0]; + return ((int *) buffer)[0]; } static gboolean @@ -266,7 +267,7 @@ output_get_underscanning_xrandr (MetaOutput *output) atom = XInternAtom (xdisplay, "underscan", False); XRRGetOutputProperty (xdisplay, - (XID)output->winsys_id, + (XID) output->winsys_id, atom, 0, G_MAXLONG, False, False, XA_ATOM, &actual_type, &actual_format, @@ -275,7 +276,7 @@ output_get_underscanning_xrandr (MetaOutput *output) if (actual_type != XA_ATOM || actual_format != 32 || nitems < 1) return FALSE; - str = XGetAtomName (xdisplay, *(Atom *)buffer); + str = XGetAtomName (xdisplay, *(Atom *) buffer); return (strcmp (str, "on") == 0); } @@ -293,7 +294,7 @@ output_get_supports_underscanning_xrandr (MetaOutput *output) atom = XInternAtom (xdisplay, "underscan", False); XRRGetOutputProperty (xdisplay, - (XID)output->winsys_id, + (XID) output->winsys_id, atom, 0, G_MAXLONG, False, False, XA_ATOM, &actual_type, &actual_format, @@ -336,7 +337,7 @@ output_get_backlight_xrandr (MetaOutput *output) atom = XInternAtom (xdisplay, "Backlight", False); XRRGetOutputProperty (xdisplay, - (XID)output->winsys_id, + (XID) output->winsys_id, atom, 0, G_MAXLONG, False, False, XA_INTEGER, &actual_type, &actual_format, @@ -345,7 +346,7 @@ output_get_backlight_xrandr (MetaOutput *output) if (actual_type != XA_INTEGER || actual_format != 32 || nitems < 1) return FALSE; - value = ((int*)buffer)[0]; + value = ((int *) buffer)[0]; if (value > 0) return normalize_backlight (output, value); else @@ -387,10 +388,10 @@ output_get_backlight_limits_xrandr (MetaOutput *output) } static guint8 * -get_edid_property (Display *xdisplay, - RROutput output, - Atom atom, - gsize *len) +get_edid_property (Display *xdisplay, + RROutput output, + Atom atom, + gsize *len) { unsigned char *prop; int actual_format; @@ -522,7 +523,7 @@ output_get_connector_type_from_prop (MetaOutput *output) atom = XInternAtom (xdisplay, "ConnectorType", False); XRRGetOutputProperty (xdisplay, - (XID)output->winsys_id, + (XID) output->winsys_id, atom, 0, G_MAXLONG, False, False, XA_ATOM, &actual_type, &actual_format, @@ -618,7 +619,7 @@ output_get_panel_orientation_transform (MetaOutput *output) g_autofree char *str = NULL; atom = XInternAtom (xdisplay, "panel orientation", False); - XRRGetOutputProperty (xdisplay, (XID)output->winsys_id, atom, + XRRGetOutputProperty (xdisplay, (XID) output->winsys_id, atom, 0, G_MAXLONG, False, False, XA_ATOM, &actual_type, &actual_format, &nitems, &bytes_after, &buffer); @@ -626,7 +627,7 @@ output_get_panel_orientation_transform (MetaOutput *output) if (actual_type != XA_ATOM || actual_format != 32 || nitems < 1) return META_MONITOR_TRANSFORM_NORMAL; - str = XGetAtomName (xdisplay, *(Atom *)buffer); + str = XGetAtomName (xdisplay, *(Atom *) buffer); if (strcmp (str, "Upside Down") == 0) return META_MONITOR_TRANSFORM_180; @@ -666,7 +667,7 @@ output_get_tile_info (MetaOutput *output) if (actual_type == XA_INTEGER && actual_format == 32 && nitems == 8) { - long *values = (long *)prop; + long *values = (long *) prop; output->tile_info.group_id = values[0]; output->tile_info.flags = values[1]; output->tile_info.max_h_tiles = values[2]; @@ -781,7 +782,7 @@ meta_create_xrandr_output (MetaGpuXrandr *gpu_xrandr, output_get_panel_orientation_transform (output); if (meta_monitor_transform_is_rotated ( - output->panel_orientation_transform)) + output->panel_orientation_transform)) { output->width_mm = xrandr_output->mm_height; output->height_mm = xrandr_output->mm_width; diff --git a/src/backends/x11/meta-renderer-x11.c b/src/backends/x11/meta-renderer-x11.c index e070d63b2..a757dbb80 100644 --- a/src/backends/x11/meta-renderer-x11.c +++ b/src/backends/x11/meta-renderer-x11.c @@ -43,7 +43,7 @@ G_DEFINE_TYPE (MetaRendererX11, meta_renderer_x11, META_TYPE_RENDERER) static const CoglWinsysVtable * -get_x11_cogl_winsys_vtable (CoglRenderer *renderer) +get_x11_cogl_winsys_vtable (CoglRenderer * renderer) { #ifdef COGL_HAS_EGL_PLATFORM_XLIB_SUPPORT if (meta_is_wayland_compositor ()) diff --git a/src/backends/x11/meta-stage-x11-nested.c b/src/backends/x11/meta-stage-x11-nested.c index 4cc58d609..9f72d61a6 100644 --- a/src/backends/x11/meta-stage-x11-nested.c +++ b/src/backends/x11/meta-stage-x11-nested.c @@ -229,11 +229,11 @@ draw_logical_monitor (MetaStageX11Nested *stage_nested, meta_monitor_mode_foreach_crtc (monitor, current_mode, draw_crtc, &(DrawCrtcData) { - .stage_nested = stage_nested, - .texture = texture, - .view = view, - .logical_monitor = logical_monitor - }, + .stage_nested = stage_nested, + .texture = texture, + .view = view, + .logical_monitor = logical_monitor + }, NULL); } @@ -274,7 +274,8 @@ meta_stage_x11_nested_finish_frame (ClutterStageWindow *stage_window) logical_monitor = meta_renderer_view_get_logical_monitor (renderer_view); if (logical_monitor) { - draw_logical_monitor (stage_nested, logical_monitor, texture, view, &view_layout); + draw_logical_monitor (stage_nested, logical_monitor, texture, view, + &view_layout); } else { @@ -289,7 +290,8 @@ meta_stage_x11_nested_finish_frame (ClutterStageWindow *stage_window) { logical_monitor = k->data; - draw_logical_monitor (stage_nested, logical_monitor, texture, view, &view_layout); + draw_logical_monitor (stage_nested, logical_monitor, texture, + view, &view_layout); } } } @@ -316,7 +318,7 @@ meta_stage_x11_nested_unrealize (ClutterStageWindow *stage_window) * 1x1 one if we're unrealizing the current one, so Cogl doesn't * keep any reference to the foreign window. */ - for (l = meta_renderer_get_views (renderer); l ;l = l->next) + for (l = meta_renderer_get_views (renderer); l; l = l->next) { ClutterStageView *view = l->data; CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view); diff --git a/src/backends/x11/nested/meta-backend-x11-nested.c b/src/backends/x11/nested/meta-backend-x11-nested.c index 923ae7c6e..04590299d 100644 --- a/src/backends/x11/nested/meta-backend-x11-nested.c +++ b/src/backends/x11/nested/meta-backend-x11-nested.c @@ -32,8 +32,8 @@ G_DEFINE_TYPE (MetaBackendX11Nested, meta_backend_x11_nested, META_TYPE_BACKEND_X11) static MetaRenderer * -meta_backend_x11_nested_create_renderer (MetaBackend *backend, - GError **error) +meta_backend_x11_nested_create_renderer (MetaBackend * backend, + GError * *error) { return g_object_new (META_TYPE_RENDERER_X11_NESTED, NULL); } @@ -99,7 +99,8 @@ meta_backend_x11_nested_select_stage_events (MetaBackend *backend) * When we're a nested application, we want to behave like any other * application, so select these events like normal apps do. */ - XISetMask (mask.mask, XI_TouchBegin); XISetMask (mask.mask, XI_TouchEnd); + XISetMask (mask.mask, XI_TouchBegin); + XISetMask (mask.mask, XI_TouchEnd); XISetMask (mask.mask, XI_TouchUpdate); XISelectEvents (xdisplay, xwin, &mask, 1); @@ -112,9 +113,9 @@ meta_backend_x11_nested_select_stage_events (MetaBackend *backend) */ XWindowAttributes xwa; - XGetWindowAttributes(xdisplay, xwin, &xwa); - XSelectInput(xdisplay, xwin, - xwa.your_event_mask | FocusChangeMask | KeymapStateMask); + XGetWindowAttributes (xdisplay, xwin, &xwa); + XSelectInput (xdisplay, xwin, + xwa.your_event_mask | FocusChangeMask | KeymapStateMask); } static void @@ -185,14 +186,21 @@ meta_backend_x11_nested_class_init (MetaBackendX11NestedClass *klass) MetaBackendX11Class *backend_x11_class = META_BACKEND_X11_CLASS (klass); backend_class->create_renderer = meta_backend_x11_nested_create_renderer; - backend_class->create_monitor_manager = meta_backend_x11_nested_create_monitor_manager; - backend_class->create_cursor_renderer = meta_backend_x11_nested_create_cursor_renderer; - backend_class->create_input_settings = meta_backend_x11_nested_create_input_settings; - backend_class->update_screen_size = meta_backend_x11_nested_update_screen_size; - backend_class->select_stage_events = meta_backend_x11_nested_select_stage_events; + backend_class->create_monitor_manager = + meta_backend_x11_nested_create_monitor_manager; + backend_class->create_cursor_renderer = + meta_backend_x11_nested_create_cursor_renderer; + backend_class->create_input_settings = + meta_backend_x11_nested_create_input_settings; + backend_class->update_screen_size = + meta_backend_x11_nested_update_screen_size; + backend_class->select_stage_events = + meta_backend_x11_nested_select_stage_events; backend_class->lock_layout_group = meta_backend_x11_nested_lock_layout_group; backend_class->set_keymap = meta_backend_x11_nested_set_keymap; - backend_x11_class->handle_host_xevent = meta_backend_x11_nested_handle_host_xevent; - backend_x11_class->translate_device_event = meta_backend_x11_nested_translate_device_event; + backend_x11_class->handle_host_xevent = + meta_backend_x11_nested_handle_host_xevent; + backend_x11_class->translate_device_event = + meta_backend_x11_nested_translate_device_event; } diff --git a/src/backends/x11/nested/meta-cursor-renderer-x11-nested.c b/src/backends/x11/nested/meta-cursor-renderer-x11-nested.c index 0daae683c..2b0b12bdc 100644 --- a/src/backends/x11/nested/meta-cursor-renderer-x11-nested.c +++ b/src/backends/x11/nested/meta-cursor-renderer-x11-nested.c @@ -83,7 +83,8 @@ meta_cursor_renderer_x11_nested_init (MetaCursorRendererX11Nested *x11_nested) } static void -meta_cursor_renderer_x11_nested_class_init (MetaCursorRendererX11NestedClass *klass) +meta_cursor_renderer_x11_nested_class_init ( + MetaCursorRendererX11NestedClass *klass) { MetaCursorRendererClass *renderer_class = META_CURSOR_RENDERER_CLASS (klass); diff --git a/src/backends/x11/nested/meta-renderer-x11-nested.c b/src/backends/x11/nested/meta-renderer-x11-nested.c index b29b9c69e..03b6ef5e5 100644 --- a/src/backends/x11/nested/meta-renderer-x11-nested.c +++ b/src/backends/x11/nested/meta-renderer-x11-nested.c @@ -103,14 +103,16 @@ create_offscreen (CoglContext *cogl_context, } static void -meta_renderer_x11_nested_resize_legacy_view (MetaRendererX11Nested *renderer_x11_nested, - int width, - int height) +meta_renderer_x11_nested_resize_legacy_view ( + MetaRendererX11Nested *renderer_x11_nested, + int width, + int height) { MetaRenderer *renderer = META_RENDERER (renderer_x11_nested); MetaBackend *backend = meta_get_backend (); ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); - CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend); + CoglContext *cogl_context = + clutter_backend_get_cogl_context (clutter_backend); MetaRendererView *legacy_view; cairo_rectangle_int_t view_layout; CoglOffscreen *fake_onscreen; @@ -124,8 +126,8 @@ meta_renderer_x11_nested_resize_legacy_view (MetaRendererX11Nested *renderer_x11 return; view_layout = (cairo_rectangle_int_t) { - .width = width, - .height = height + .width = width, + .height = height }; fake_onscreen = create_offscreen (cogl_context, width, height); @@ -137,14 +139,16 @@ meta_renderer_x11_nested_resize_legacy_view (MetaRendererX11Nested *renderer_x11 } void -meta_renderer_x11_nested_ensure_legacy_view (MetaRendererX11Nested *renderer_x11_nested, - int width, - int height) +meta_renderer_x11_nested_ensure_legacy_view ( + MetaRendererX11Nested *renderer_x11_nested, + int width, + int height) { MetaRenderer *renderer = META_RENDERER (renderer_x11_nested); MetaBackend *backend = meta_get_backend (); ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); - CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend); + CoglContext *cogl_context = + clutter_backend_get_cogl_context (clutter_backend); cairo_rectangle_int_t view_layout; CoglOffscreen *fake_onscreen; MetaRendererView *legacy_view; @@ -178,7 +182,8 @@ meta_renderer_x11_nested_create_view (MetaRenderer *renderer, MetaMonitorManager *monitor_manager = meta_backend_get_monitor_manager (backend); ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); - CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend); + CoglContext *cogl_context = + clutter_backend_get_cogl_context (clutter_backend); MetaMonitorTransform view_transform; float view_scale; int width, height; @@ -234,4 +239,3 @@ meta_renderer_x11_nested_class_init (MetaRendererX11NestedClass *klass) renderer_class->create_view = meta_renderer_x11_nested_create_view; } - |