recorder: Hide cursor while magnifier is active

The magnifier adds its own copy of the system cursor to apply the
expected transformations, so we don't need to add it again in the
recorder; this avoids two different cursors showing up in recordings,
but doesn't address the case where the cursor should not be recorded
at all, but the magnifier adds it anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=700488
This commit is contained in:
Florian Müllner 2013-05-22 17:48:56 +02:00
parent 73903400c5
commit c7eed59562

View File

@ -25,6 +25,9 @@
/* This is also hard-coded in mutter and GDK */ /* This is also hard-coded in mutter and GDK */
#define VIRTUAL_CORE_POINTER_ID 2 #define VIRTUAL_CORE_POINTER_ID 2
#define A11Y_APPS_SCHEMA "org.gnome.desktop.a11y.applications"
#define MAGNIFIER_ACTIVE_KEY "screen-magnifier-enabled"
typedef enum { typedef enum {
RECORDER_STATE_CLOSED, RECORDER_STATE_CLOSED,
RECORDER_STATE_RECORDING RECORDER_STATE_RECORDING
@ -68,6 +71,7 @@ struct _ShellRecorder {
CoglHandle recording_icon; /* icon shown while playing */ CoglHandle recording_icon; /* icon shown while playing */
GSettings *a11y_settings;
gboolean draw_cursor; gboolean draw_cursor;
cairo_surface_t *cursor_image; cairo_surface_t *cursor_image;
int cursor_hot_x; int cursor_hot_x;
@ -277,6 +281,8 @@ shell_recorder_init (ShellRecorder *recorder)
recorder->recording_icon = create_recording_icon (); recorder->recording_icon = create_recording_icon ();
recorder->memory_target = get_memory_target(); recorder->memory_target = get_memory_target();
recorder->a11y_settings = g_settings_new (A11Y_APPS_SCHEMA);
recorder->state = RECORDER_STATE_CLOSED; recorder->state = RECORDER_STATE_CLOSED;
recorder->framerate = DEFAULT_FRAMES_PER_SECOND; recorder->framerate = DEFAULT_FRAMES_PER_SECOND;
recorder->draw_cursor = TRUE; recorder->draw_cursor = TRUE;
@ -299,6 +305,8 @@ shell_recorder_finalize (GObject *object)
cogl_handle_unref (recorder->recording_icon); cogl_handle_unref (recorder->recording_icon);
g_clear_object (&recorder->a11y_settings);
G_OBJECT_CLASS (shell_recorder_parent_class)->finalize (object); G_OBJECT_CLASS (shell_recorder_parent_class)->finalize (object);
} }
@ -580,7 +588,8 @@ recorder_record_frame (ShellRecorder *recorder)
GST_BUFFER_PTS(buffer) = now - recorder->start_time; GST_BUFFER_PTS(buffer) = now - recorder->start_time;
if (recorder->draw_cursor) if (recorder->draw_cursor &&
!g_settings_get_boolean (recorder->a11y_settings, MAGNIFIER_ACTIVE_KEY))
recorder_draw_cursor (recorder, buffer); recorder_draw_cursor (recorder, buffer);
shell_recorder_src_add_buffer (SHELL_RECORDER_SRC (recorder->current_pipeline->src), buffer); shell_recorder_src_add_buffer (SHELL_RECORDER_SRC (recorder->current_pipeline->src), buffer);