clutter: Fix const qualifier usage

The const qualifiers were implicitly discarded here and there. Avoid that
either by adding the constness, or casting it away when a const variable
is passed to a function that is defined as non-const but effectively
expect a const.
This commit is contained in:
Jonas Ådahl 2019-01-20 09:09:50 +01:00
parent caf27c4c16
commit 44477390a9
5 changed files with 27 additions and 27 deletions

View File

@ -480,7 +480,7 @@ xsettings_client_new_with_grab_funcs (Display *display,
{ {
XSettingsClient *client; XSettingsClient *client;
char buffer[256]; char buffer[256];
char *atom_names[3]; const char *atom_names[3];
Atom atoms[3]; Atom atoms[3];
client = malloc (sizeof *client); client = malloc (sizeof *client);

View File

@ -7,8 +7,8 @@
typedef struct typedef struct
{ {
char *name; const char *name;
char *source; const char *source;
} ShaderSource; } ShaderSource;
int int

View File

@ -59,7 +59,7 @@ get_event_type_name (const ClutterEvent *event)
static gchar * static gchar *
get_event_state_string (const ClutterEvent *event) get_event_state_string (const ClutterEvent *event)
{ {
gchar *mods[18]; const char *mods[18];
int i = 0; int i = 0;
ClutterModifierType state = clutter_event_get_state (event); ClutterModifierType state = clutter_event_get_state (event);
@ -102,7 +102,7 @@ get_event_state_string (const ClutterEvent *event)
mods[i++] = "-"; mods[i++] = "-";
mods[i] = NULL; mods[i] = NULL;
return g_strjoinv (",", mods); return g_strjoinv (",", (char **) mods);
} }
static void static void
@ -428,15 +428,15 @@ test_events_main (int argc, char *argv[])
clutter_stage_set_title (CLUTTER_STAGE (stage), "Events"); clutter_stage_set_title (CLUTTER_STAGE (stage), "Events");
clutter_actor_set_name (stage, "Stage"); clutter_actor_set_name (stage, "Stage");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
g_signal_connect (stage, "event", G_CALLBACK (input_cb), "stage"); g_signal_connect (stage, "event", G_CALLBACK (input_cb), (char *) "stage");
g_signal_connect (stage, "fullscreen", g_signal_connect (stage, "fullscreen",
G_CALLBACK (stage_state_cb), "fullscreen"); G_CALLBACK (stage_state_cb), (char *) "fullscreen");
g_signal_connect (stage, "unfullscreen", g_signal_connect (stage, "unfullscreen",
G_CALLBACK (stage_state_cb), "unfullscreen"); G_CALLBACK (stage_state_cb), (char *) "unfullscreen");
g_signal_connect (stage, "activate", g_signal_connect (stage, "activate",
G_CALLBACK (stage_state_cb), "activate"); G_CALLBACK (stage_state_cb), (char *) "activate");
g_signal_connect (stage, "deactivate", g_signal_connect (stage, "deactivate",
G_CALLBACK (stage_state_cb), "deactivate"); G_CALLBACK (stage_state_cb), (char *) "deactivate");
focus_box = clutter_rectangle_new_with_color (CLUTTER_COLOR_Black); focus_box = clutter_rectangle_new_with_color (CLUTTER_COLOR_Black);
clutter_actor_set_name (focus_box, "Focus Box"); clutter_actor_set_name (focus_box, "Focus Box");
@ -448,7 +448,7 @@ test_events_main (int argc, char *argv[])
clutter_actor_set_position (actor, 100, 100); clutter_actor_set_position (actor, 100, 100);
clutter_actor_set_reactive (actor, TRUE); clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL); clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
g_signal_connect (actor, "event", G_CALLBACK (input_cb), "red box"); g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "red box");
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb), g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
focus_box); focus_box);
/* Toggle motion - enter/leave capture */ /* Toggle motion - enter/leave capture */
@ -463,7 +463,7 @@ test_events_main (int argc, char *argv[])
clutter_actor_set_position (actor, 250, 100); clutter_actor_set_position (actor, 250, 100);
clutter_actor_set_reactive (actor, TRUE); clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL); clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
g_signal_connect (actor, "event", G_CALLBACK (input_cb), "green box"); g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "green box");
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb), g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
focus_box); focus_box);
g_signal_connect (actor, "captured-event", G_CALLBACK (capture_cb), NULL); g_signal_connect (actor, "captured-event", G_CALLBACK (capture_cb), NULL);
@ -474,7 +474,7 @@ test_events_main (int argc, char *argv[])
clutter_actor_set_position (actor, 400, 100); clutter_actor_set_position (actor, 400, 100);
clutter_actor_set_reactive (actor, TRUE); clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER(stage), actor, NULL); clutter_container_add (CLUTTER_CONTAINER(stage), actor, NULL);
g_signal_connect (actor, "event", G_CALLBACK (input_cb), "blue box"); g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "blue box");
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb), g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
focus_box); focus_box);
/* Fullscreen */ /* Fullscreen */
@ -487,7 +487,7 @@ test_events_main (int argc, char *argv[])
clutter_actor_set_size (actor, 400, 50); clutter_actor_set_size (actor, 400, 50);
clutter_actor_set_position (actor, 100, 250); clutter_actor_set_position (actor, 100, 250);
clutter_container_add (CLUTTER_CONTAINER(stage), actor, NULL); clutter_container_add (CLUTTER_CONTAINER(stage), actor, NULL);
g_signal_connect (actor, "event", G_CALLBACK (input_cb), "blue box"); g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "blue box");
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb), g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
focus_box); focus_box);
g_signal_connect (stage, "key-focus-in", G_CALLBACK (key_focus_in_cb), g_signal_connect (stage, "key-focus-in", G_CALLBACK (key_focus_in_cb),
@ -499,7 +499,7 @@ test_events_main (int argc, char *argv[])
clutter_actor_set_size (actor, 100, 100); clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_reactive (actor, TRUE); clutter_actor_set_reactive (actor, TRUE);
g_signal_connect (actor, "event", G_CALLBACK (input_cb), "yellow box"); g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "yellow box");
/* note group not reactive */ /* note group not reactive */
group = clutter_group_new (); group = clutter_group_new ();

View File

@ -217,22 +217,22 @@ test_grab_main (int argc, char *argv[])
clutter_stage_set_title (CLUTTER_STAGE (stage), "Grabs"); clutter_stage_set_title (CLUTTER_STAGE (stage), "Grabs");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
g_signal_connect (stage, "event", g_signal_connect (stage, "event",
G_CALLBACK (debug_event_cb), "stage"); G_CALLBACK (debug_event_cb), (char *) "stage");
g_signal_connect (stage, "fullscreen", g_signal_connect (stage, "fullscreen",
G_CALLBACK (stage_state_cb), "fullscreen"); G_CALLBACK (stage_state_cb), (char *) "fullscreen");
g_signal_connect (stage, "unfullscreen", g_signal_connect (stage, "unfullscreen",
G_CALLBACK (stage_state_cb), "unfullscreen"); G_CALLBACK (stage_state_cb), (char *) "unfullscreen");
g_signal_connect (stage, "activate", g_signal_connect (stage, "activate",
G_CALLBACK (stage_state_cb), "activate"); G_CALLBACK (stage_state_cb), (char *) "activate");
g_signal_connect (stage, "deactivate", g_signal_connect (stage, "deactivate",
G_CALLBACK (stage_state_cb), "deactivate"); G_CALLBACK (stage_state_cb), (char *) "deactivate");
actor = clutter_rectangle_new_with_color (&rcol); actor = clutter_rectangle_new_with_color (&rcol);
clutter_actor_set_size (actor, 100, 100); clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_position (actor, 100, 100); clutter_actor_set_position (actor, 100, 100);
clutter_actor_set_reactive (actor, TRUE); clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL); clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
g_signal_connect (actor, "event", G_CALLBACK (debug_event_cb), "red box"); g_signal_connect (actor, "event", G_CALLBACK (debug_event_cb), (char *) "red box");
g_signal_connect (actor, "button-press-event", g_signal_connect (actor, "button-press-event",
G_CALLBACK (grab_pointer_cb), NULL); G_CALLBACK (grab_pointer_cb), NULL);
g_signal_connect (actor, "button-release-event", g_signal_connect (actor, "button-release-event",
@ -243,7 +243,7 @@ test_grab_main (int argc, char *argv[])
clutter_actor_set_position (actor, 100, 300); clutter_actor_set_position (actor, 100, 300);
clutter_actor_set_reactive (actor, TRUE); clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL); clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
g_signal_connect (actor, "event", G_CALLBACK (debug_event_cb), "yellow box"); g_signal_connect (actor, "event", G_CALLBACK (debug_event_cb), (char *) "yellow box");
g_signal_connect (actor, "button-press-event", g_signal_connect (actor, "button-press-event",
G_CALLBACK (toggle_grab_pointer_cb), NULL); G_CALLBACK (toggle_grab_pointer_cb), NULL);
@ -253,7 +253,7 @@ test_grab_main (int argc, char *argv[])
clutter_actor_set_reactive (actor, TRUE); clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL); clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
g_signal_connect (actor, "event", g_signal_connect (actor, "event",
G_CALLBACK (debug_event_cb), "blue box"); G_CALLBACK (debug_event_cb), (char *) "blue box");
g_signal_connect (actor, "button-press-event", g_signal_connect (actor, "button-press-event",
G_CALLBACK (grab_pointer_cb), NULL); G_CALLBACK (grab_pointer_cb), NULL);
g_signal_connect (actor, "button-release-event", g_signal_connect (actor, "button-release-event",
@ -265,7 +265,7 @@ test_grab_main (int argc, char *argv[])
clutter_actor_set_reactive (actor, TRUE); clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL); clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
g_signal_connect (actor, "event", g_signal_connect (actor, "event",
G_CALLBACK (debug_event_cb), "green box"); G_CALLBACK (debug_event_cb), (char *) "green box");
g_signal_connect (actor, "button-press-event", g_signal_connect (actor, "button-press-event",
G_CALLBACK (green_press_cb), NULL); G_CALLBACK (green_press_cb), NULL);
@ -276,7 +276,7 @@ test_grab_main (int argc, char *argv[])
clutter_actor_set_reactive (actor, TRUE); clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL); clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
g_signal_connect (actor, "event", g_signal_connect (actor, "event",
G_CALLBACK (debug_event_cb), "cyan box"); G_CALLBACK (debug_event_cb), (char *) "cyan box");
g_signal_connect (actor, "button-press-event", g_signal_connect (actor, "button-press-event",
G_CALLBACK (cyan_press_cb), NULL); G_CALLBACK (cyan_press_cb), NULL);

View File

@ -27,12 +27,12 @@ make_label (void)
{ {
ClutterActor *label; ClutterActor *label;
gchar *text; gchar *text;
gchar *argv[] = { "ls", "--help", NULL }; const char *argv[] = { "ls", "--help", NULL };
label = clutter_text_new (); label = clutter_text_new ();
clutter_text_set_font_name (CLUTTER_TEXT (label), "Sans 10"); clutter_text_set_font_name (CLUTTER_TEXT (label), "Sans 10");
if (g_spawn_sync (NULL, argv, NULL, if (g_spawn_sync (NULL, (char **) argv, NULL,
G_SPAWN_STDERR_TO_DEV_NULL | G_SPAWN_SEARCH_PATH, G_SPAWN_STDERR_TO_DEV_NULL | G_SPAWN_SEARCH_PATH,
NULL, NULL, &text, NULL, NULL, NULL)) NULL, NULL, &text, NULL, NULL, NULL))
{ {