summaryrefslogtreecommitdiff
path: root/plugins/media-keys
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-02-02 09:57:38 +0100
committerLuke from DC <[email protected]>2021-02-23 06:00:32 +0000
commit976158eb7f8ed85db62ad54b1bab9ebce7b0863e (patch)
treef60086953e40e77042319e9a7d2f20ab7725e224 /plugins/media-keys
parent58c2428f58f9cf08234419a217f65b0ea266039e (diff)
downloadmate-settings-daemon-976158eb7f8ed85db62ad54b1bab9ebce7b0863e.tar.bz2
mate-settings-daemon-976158eb7f8ed85db62ad54b1bab9ebce7b0863e.tar.xz
media-keys: Remove conversion warnings
Diffstat (limited to 'plugins/media-keys')
-rw-r--r--plugins/media-keys/msd-media-keys-manager.c18
-rw-r--r--plugins/media-keys/msd-media-keys-window.c30
-rw-r--r--plugins/media-keys/msd-media-keys-window.h2
3 files changed, 26 insertions, 24 deletions
diff --git a/plugins/media-keys/msd-media-keys-manager.c b/plugins/media-keys/msd-media-keys-manager.c
index 09eaefb..fe33351 100644
--- a/plugins/media-keys/msd-media-keys-manager.c
+++ b/plugins/media-keys/msd-media-keys-manager.c
@@ -665,7 +665,7 @@ update_dialog (MsdMediaKeysManager *manager,
gboolean is_mic)
{
if (muted)
- volume = 0.0;
+ volume = 0;
dialog_init (manager);
@@ -705,7 +705,8 @@ do_sound_action (MsdMediaKeysManager *manager,
gboolean sound_changed = FALSE;
guint volume;
guint volume_min, volume_max;
- guint volume_step;
+ gint volume_step;
+ guint volume_step_scaled;
guint volume_last;
MateMixerStreamControl *control;
@@ -726,12 +727,13 @@ do_sound_action (MsdMediaKeysManager *manager,
volume_step = g_settings_get_int (manager->priv->settings, "volume-step");
if (volume_step <= 0 || volume_step > 100) {
GVariant *variant = g_settings_get_default_value (manager->priv->settings, "volume-step");
- volume_step = g_variant_get_int32 (variant);
+ gint32 volume_step_default = g_variant_get_int32 (variant);
+ volume_step = (gint) volume_step_default;
g_variant_unref (variant);
}
/* Scale the volume step size accordingly to the range used by the control */
- volume_step = (volume_max - volume_min) * volume_step / 100;
+ volume_step_scaled = (volume_max - volume_min) * (guint) volume_step / 100;
volume = volume_last =
mate_mixer_stream_control_get_volume (control);
@@ -744,11 +746,11 @@ do_sound_action (MsdMediaKeysManager *manager,
muted = !muted;
break;
case VOLUME_DOWN_KEY:
- if (volume <= (volume_min + volume_step)) {
+ if (volume <= (volume_min + volume_step_scaled)) {
volume = volume_min;
muted = TRUE;
} else {
- volume -= volume_step;
+ volume -= volume_step_scaled;
muted = FALSE;
}
break;
@@ -756,9 +758,9 @@ do_sound_action (MsdMediaKeysManager *manager,
if (muted) {
muted = FALSE;
if (volume <= volume_min)
- volume = volume_min + volume_step;
+ volume = volume_min + volume_step_scaled;
} else
- volume = CLAMP (volume + volume_step,
+ volume = CLAMP (volume + volume_step_scaled,
volume_min,
volume_max);
break;
diff --git a/plugins/media-keys/msd-media-keys-window.c b/plugins/media-keys/msd-media-keys-window.c
index 9c36641..4fb821a 100644
--- a/plugins/media-keys/msd-media-keys-window.c
+++ b/plugins/media-keys/msd-media-keys-window.c
@@ -43,7 +43,7 @@ struct MsdMediaKeysWindowPrivate
guint volume_muted : 1;
guint mic_muted : 1;
guint is_mic :1;
- int volume_level;
+ guint volume_level;
GtkImage *image;
GtkWidget *progress;
@@ -223,7 +223,7 @@ msd_media_keys_window_set_volume_muted (MsdMediaKeysWindow *window,
g_return_if_fail (MSD_IS_MEDIA_KEYS_WINDOW (window));
if (window->priv->volume_muted != muted) {
- window->priv->volume_muted = muted;
+ window->priv->volume_muted = muted != FALSE;
volume_muted_changed (window);
}
window->priv->is_mic = FALSE;
@@ -236,7 +236,7 @@ msd_media_keys_window_set_mic_muted (MsdMediaKeysWindow *window,
g_return_if_fail (MSD_IS_MEDIA_KEYS_WINDOW (window));
if (window->priv->mic_muted != muted) {
- window->priv->mic_muted = muted;
+ window->priv->mic_muted = muted != FALSE;
mic_muted_changed (window);
}
window->priv->is_mic = TRUE;
@@ -244,7 +244,7 @@ msd_media_keys_window_set_mic_muted (MsdMediaKeysWindow *window,
void
msd_media_keys_window_set_volume_level (MsdMediaKeysWindow *window,
- int level)
+ guint level)
{
g_return_if_fail (MSD_IS_MEDIA_KEYS_WINDOW (window));
@@ -284,26 +284,26 @@ draw_eject (cairo_t *cr,
double width,
double height)
{
- int box_height;
- int tri_height;
- int separation;
+ double box_height;
+ double tri_height;
+ double separation;
box_height = height * 0.2;
- separation = box_height / 3;
+ separation = box_height / 3.0;
tri_height = height - box_height - separation;
cairo_rectangle (cr, _x0, _y0 + height - box_height, width, box_height);
cairo_move_to (cr, _x0, _y0 + tri_height);
- cairo_rel_line_to (cr, width, 0);
- cairo_rel_line_to (cr, -width / 2, -tri_height);
- cairo_rel_line_to (cr, -width / 2, tri_height);
+ cairo_rel_line_to (cr, width, 0.0);
+ cairo_rel_line_to (cr, -width * 0.5, -tri_height);
+ cairo_rel_line_to (cr, -width * 0.5, tri_height);
cairo_close_path (cr);
cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, MSD_OSD_WINDOW_FG_ALPHA);
cairo_fill_preserve (cr);
- cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, MSD_OSD_WINDOW_FG_ALPHA / 2);
- cairo_set_line_width (cr, 2);
+ cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, MSD_OSD_WINDOW_FG_ALPHA * 0.5);
+ cairo_set_line_width (cr, 2.0);
cairo_stroke (cr);
}
@@ -418,7 +418,7 @@ render_speaker (MsdMediaKeysWindow *window,
{
GdkPixbuf *pixbuf;
int icon_size;
- int n;
+ guint n;
static const char *icon_names[] = {
"audio-volume-muted",
"audio-volume-low",
@@ -605,7 +605,7 @@ draw_action_volume (MsdMediaKeysWindow *window,
wave_y0 = speaker_cy;
wave_radius = icon_box_width / 2;
- draw_waves (cr, wave_x0, wave_y0, wave_radius, window->priv->volume_level);
+ draw_waves (cr, wave_x0, wave_y0, wave_radius, (int) window->priv->volume_level);
} else {
/* draw 'mute' cross */
double cross_x0;
diff --git a/plugins/media-keys/msd-media-keys-window.h b/plugins/media-keys/msd-media-keys-window.h
index 88c3748..d911e41 100644
--- a/plugins/media-keys/msd-media-keys-window.h
+++ b/plugins/media-keys/msd-media-keys-window.h
@@ -70,7 +70,7 @@ void msd_media_keys_window_set_mic_muted (MsdMediaKeysWindo
void msd_media_keys_window_set_volume_muted (MsdMediaKeysWindow *window,
gboolean muted);
void msd_media_keys_window_set_volume_level (MsdMediaKeysWindow *window,
- int level);
+ guint level);
gboolean msd_media_keys_window_is_valid (MsdMediaKeysWindow *window);
#ifdef __cplusplus