Skip to content

Commit

Permalink
Remove compilation warning fix data type format error
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuyaliang authored and raveit65 committed Nov 6, 2023
1 parent 9a8cfd7 commit 688ec2f
Show file tree
Hide file tree
Showing 21 changed files with 133 additions and 113 deletions.
20 changes: 9 additions & 11 deletions applets/brightness/brightness-applet.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ gpm_applet_update_tooltip (GpmBrightnessApplet *applet)
} else if (applet->call_worked == FALSE) {
buf = g_strdup (_("Cannot get laptop panel brightness"));
} else {
buf = g_strdup_printf (_("LCD brightness : %d%%"), applet->level);
buf = g_strdup_printf (_("LCD brightness : %u%%"), applet->level);
}
gtk_widget_set_tooltip_text (GTK_WIDGET(applet), buf);
} else {
Expand Down Expand Up @@ -607,6 +607,10 @@ static void
gpm_applet_create_popup (GpmBrightnessApplet *applet)
{
static GtkWidget *box, *frame;
GtkWidget *toplevel;
GtkStyleContext *context;
GdkScreen *screen;
GdkVisual *visual;
gint orientation = mate_panel_applet_get_orient (MATE_PANEL_APPLET (MATE_PANEL_APPLET (applet)));

gpm_applet_destroy_popup_cb (applet);
Expand Down Expand Up @@ -664,13 +668,12 @@ gpm_applet_create_popup (GpmBrightnessApplet *applet)
G_CALLBACK(gpm_applet_key_press_cb), applet);

/* Set volume control frame, slider and toplevel window to follow panel volume control theme */
GtkWidget *toplevel = gtk_widget_get_toplevel (frame);
GtkStyleContext *context;
toplevel = gtk_widget_get_toplevel (frame);
context = gtk_widget_get_style_context (GTK_WIDGET(toplevel));
gtk_style_context_add_class(context,"mate-panel-applet-slider");
/*Make transparency possible in gtk3 theme3 */
GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(toplevel));
GdkVisual *visual = gdk_screen_get_rgba_visual(screen);
screen = gtk_widget_get_screen(GTK_WIDGET(toplevel));
visual = gdk_screen_get_rgba_visual(screen);
gtk_widget_set_visual(GTK_WIDGET(toplevel), visual);
}

Expand Down Expand Up @@ -702,11 +705,6 @@ gpm_applet_popup_cb (GpmBrightnessApplet *applet, GdkEventButton *event)
return TRUE;
}

/* don't show the popup if brightness is unavailable */
if (applet->level == -1) {
return FALSE;
}

/* otherwise pop */
applet->popped = TRUE;

Expand Down Expand Up @@ -899,7 +897,7 @@ brightness_changed_cb (DBusGProxy *proxy,
guint brightness,
GpmBrightnessApplet *applet)
{
g_debug ("BrightnessChanged detected: %i\n", brightness);
g_debug ("BrightnessChanged detected: %u\n", brightness);
applet->level = brightness;
}

Expand Down
2 changes: 2 additions & 0 deletions applets/inhibit/inhibit-applet.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ gpm_applet_size_allocate_cb (GtkWidget *widget,
case MATE_PANEL_APPLET_ORIENT_DOWN:
size = allocation->height;
break;
default:
break;
}

/* Scale to the actual size of the applet, don't quantize to original icon size */
Expand Down
6 changes: 3 additions & 3 deletions src/egg-array-float.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ gfloat
egg_array_float_get (EggArrayFloat *array, guint i)
{
if (i >= array->len)
g_error ("above index! (%i)", i);
g_error ("above index! (%u)", i);
return g_array_index (array, gfloat, i);
}

Expand Down Expand Up @@ -150,7 +150,7 @@ egg_array_float_compute_gaussian (guint length, gfloat sigma)
half_length = (length / 2) + 1;
for (i=0; i<half_length; i++) {
division = half_length - (i + 1);
g_debug ("half_length=%i, div=%f, sigma=%f", half_length, division, sigma);
g_debug ("half_length=%u, div=%f, sigma=%f", half_length, division, sigma);
g_array_index (array, gfloat, i) = egg_array_float_guassian_value (division, sigma);
}

Expand Down Expand Up @@ -207,7 +207,7 @@ egg_array_float_print (EggArrayFloat *array)
length = array->len;
/* debug out */
for (i=0; i<length; i++)
g_debug ("[%i]\tval=%f", i, g_array_index (array, gfloat, i));
g_debug ("[%u]\tval=%f", i, g_array_index (array, gfloat, i));
return TRUE;
}

Expand Down
2 changes: 1 addition & 1 deletion src/egg-console-kit.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ egg_console_kit_init (EggConsoleKit *console)
DBUS_TYPE_G_OBJECT_PATH, &console->priv->session_id,
G_TYPE_INVALID);
if (!ret) {
g_warning ("Failed to get session for pid %i: %s", pid, error->message);
g_warning ("Failed to get session for pid %u: %s", pid, error->message);
g_error_free (error);
goto out;
}
Expand Down
2 changes: 1 addition & 1 deletion src/egg-idletime.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ egg_idletime_init (EggIdletime *idletime)
int ncounters;
XSyncSystemCounter *counters;
EggIdletimeAlarm *alarm;
guint i;
gint i;

idletime->priv = egg_idletime_get_instance_private (idletime);

Expand Down
2 changes: 1 addition & 1 deletion src/egg-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct EggTest {
* egg_test_init:
**/
EggTest *
egg_test_init ()
egg_test_init (void)
{
EggTest *test;
test = g_new (EggTest, 1);
Expand Down
24 changes: 12 additions & 12 deletions src/gpm-backlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ gpm_backlight_set_brightness (GpmBacklight *backlight, guint percentage, GError
}
/* we emit a signal for the brightness applet */
if (ret && hw_changed) {
g_debug ("emitting brightness-changed : %i", percentage);
g_debug ("emitting brightness-changed : %u", percentage);
g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, percentage);
}
return ret;
Expand Down Expand Up @@ -298,7 +298,7 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int
if (on_battery && battery_reduce) {
value = g_settings_get_int (backlight->priv->settings, GPM_SETTINGS_BRIGHTNESS_DIM_BATT);
if (value > 100) {
g_warning ("cannot use battery brightness value %i, correcting to 50", value);
g_warning ("cannot use battery brightness value %u, correcting to 50", value);
value = 50;
}
scale = (100 - value) / 100.0f;
Expand All @@ -317,7 +317,7 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int
if (enable_action && backlight->priv->system_is_idle) {
value = g_settings_get_int (backlight->priv->settings, GPM_SETTINGS_IDLE_BRIGHTNESS);
if (value > 100) {
g_warning ("cannot use idle brightness value %i, correcting to 50", value);
g_warning ("cannot use idle brightness value %u, correcting to 50", value);
value = 50;
}
scale = value / 100.0f;
Expand Down Expand Up @@ -348,7 +348,7 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int
ret = gpm_brightness_set (backlight->priv->brightness, value, &hw_changed);
/* we emit a signal for the brightness applet */
if (ret && hw_changed) {
g_debug ("emitting brightness-changed : %i", value);
g_debug ("emitting brightness-changed : %u", value);
g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, value);
}
return TRUE;
Expand Down Expand Up @@ -437,14 +437,14 @@ gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBackli
/* if using AC power supply, save the new brightness settings */
g_object_get (backlight->priv->client, "on-battery", &on_battery, NULL);
if (!on_battery) {
g_debug ("saving brightness for ac supply: %i", percentage);
g_debug ("saving brightness for ac supply: %u", percentage);
g_settings_set_double (backlight->priv->settings, GPM_SETTINGS_BRIGHTNESS_AC,
percentage*1.0);
}
}
/* we emit a signal for the brightness applet */
if (ret && hw_changed) {
g_debug ("emitting brightness-changed : %i", percentage);
g_debug ("emitting brightness-changed : %u", percentage);
g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, percentage);
}
} else if (g_strcmp0 (type, GPM_BUTTON_BRIGHT_DOWN) == 0) {
Expand All @@ -463,14 +463,14 @@ gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBackli
/* if using AC power supply, save the new brightness settings */
g_object_get (backlight->priv->client, "on-battery", &on_battery, NULL);
if (!on_battery) {
g_debug ("saving brightness for ac supply: %i", percentage);
g_debug ("saving brightness for ac supply: %u", percentage);
g_settings_set_double (backlight->priv->settings, GPM_SETTINGS_BRIGHTNESS_AC,
percentage*1.0);
}
}
/* we emit a signal for the brightness applet */
if (ret && hw_changed) {
g_debug ("emitting brightness-changed : %i", percentage);
g_debug ("emitting brightness-changed : %u", percentage);
g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, percentage);
}
} else if (g_strcmp0 (type, GPM_BUTTON_LID_OPEN) == 0) {
Expand Down Expand Up @@ -512,7 +512,7 @@ gpm_backlight_notify_system_idle_changed (GpmBacklight *backlight, gboolean is_i
if (elapsed < 10) {
/* double the event time */
backlight->priv->idle_dim_timeout *= 2.0;
g_debug ("increasing idle dim time to %is", backlight->priv->idle_dim_timeout);
g_debug ("increasing idle dim time to %us", backlight->priv->idle_dim_timeout);
gpm_idle_set_timeout_dim (backlight->priv->idle, backlight->priv->idle_dim_timeout);
}

Expand All @@ -523,7 +523,7 @@ gpm_backlight_notify_system_idle_changed (GpmBacklight *backlight, gboolean is_i
backlight->priv->idle_dim_timeout =
g_settings_get_int (backlight->priv->settings,
GPM_SETTINGS_IDLE_DIM_TIME);
g_debug ("resetting idle dim time to %is", backlight->priv->idle_dim_timeout);
g_debug ("resetting idle dim time to %us", backlight->priv->idle_dim_timeout);
gpm_idle_set_timeout_dim (backlight->priv->idle, backlight->priv->idle_dim_timeout);
}
} else {
Expand Down Expand Up @@ -606,7 +606,7 @@ idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmBacklight *backlight)

/* check if method is valid */
if (dpms_mode == GPM_DPMS_MODE_UNKNOWN || dpms_mode == GPM_DPMS_MODE_ON) {
g_warning ("BACKLIGHT method %i unknown. Using OFF.", dpms_mode);
g_warning ("BACKLIGHT method %u unknown. Using OFF.", dpms_mode);
dpms_mode = GPM_DPMS_MODE_OFF;
}

Expand Down Expand Up @@ -635,7 +635,7 @@ brightness_changed_cb (GpmBrightness *brightness, guint percentage, GpmBacklight
backlight->priv->master_percentage = percentage;

/* we emit a signal for the brightness applet */
g_debug ("emitting brightness-changed : %i", percentage);
g_debug ("emitting brightness-changed : %u", percentage);
g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, percentage);
}

Expand Down
30 changes: 15 additions & 15 deletions src/gpm-brightness.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ gpm_brightness_output_set_internal (GpmBrightness *brightness, RROutput output,
XFlush (brightness->priv->dpy);
gdk_display_flush (display);
if (gdk_x11_display_error_trap_pop (display)) {
g_warning ("failed to XRRChangeOutputProperty for brightness %i", value);
g_warning ("failed to XRRChangeOutputProperty for brightness %u", value);
ret = FALSE;
}
/* we changed the hardware */
Expand Down Expand Up @@ -334,9 +334,9 @@ gpm_brightness_output_get_percentage (GpmBrightness *brightness, RROutput output
ret = gpm_brightness_output_get_limits (brightness, output, &min, &max);
if (!ret || min == max)
return FALSE;
g_debug ("hard value=%i, min=%i, max=%i", cur, min, max);
g_debug ("hard value=%u, min=%u, max=%u", cur, min, max);
percentage = egg_discrete_to_percent (cur, (max-min)+1);
g_debug ("percentage %i", percentage);
g_debug ("percentage %u", percentage);
brightness->priv->shared_value = percentage;
return TRUE;
}
Expand All @@ -360,14 +360,14 @@ gpm_brightness_output_down (GpmBrightness *brightness, RROutput output)
ret = gpm_brightness_output_get_limits (brightness, output, &min, &max);
if (!ret || min == max)
return FALSE;
g_debug ("hard value=%i, min=%i, max=%i", cur, min, max);
g_debug ("hard value=%u, min=%u, max=%u", cur, min, max);
if (cur == min) {
g_debug ("already min");
return TRUE;
}
step = gpm_brightness_get_step ((max-min)+1);
if (cur < step) {
g_debug ("truncating to %i", min);
g_debug ("truncating to %u", min);
cur = min;
} else {
cur -= step;
Expand All @@ -394,14 +394,14 @@ gpm_brightness_output_up (GpmBrightness *brightness, RROutput output)
ret = gpm_brightness_output_get_limits (brightness, output, &min, &max);
if (!ret || min == max)
return FALSE;
g_debug ("hard value=%i, min=%i, max=%i", cur, min, max);
g_debug ("hard value=%u, min=%u, max=%u", cur, min, max);
if (cur == max) {
g_debug ("already max");
return TRUE;
}
cur += gpm_brightness_get_step ((max-min)+1);
if (cur > max) {
g_debug ("truncating to %i", max);
g_debug ("truncating to %u", max);
cur = max;
}
ret = gpm_brightness_output_set_internal (brightness, output, cur);
Expand Down Expand Up @@ -431,15 +431,15 @@ gpm_brightness_output_set (GpmBrightness *brightness, RROutput output)
return FALSE;

shared_value_abs = egg_discrete_from_percent (brightness->priv->shared_value, (max-min)+1);
g_debug ("percent=%i, absolute=%i", brightness->priv->shared_value, shared_value_abs);
g_debug ("percent=%u, absolute=%i", brightness->priv->shared_value, shared_value_abs);

g_debug ("hard value=%i, min=%i, max=%i", cur, min, max);
g_debug ("hard value=%u, min=%u, max=%u", cur, min, max);
if (shared_value_abs > (gint) max)
shared_value_abs = max;
if (shared_value_abs < (gint) min)
shared_value_abs = min;
if ((gint) cur == shared_value_abs) {
g_debug ("already set %i", cur);
g_debug ("already set %u", cur);
return TRUE;
}

Expand All @@ -448,7 +448,7 @@ gpm_brightness_output_set (GpmBrightness *brightness, RROutput output)

/* some adaptors have a large number of steps */
step = gpm_brightness_get_step (shared_value_abs - cur);
g_debug ("using step of %i", step);
g_debug ("using step of %u", step);

/* going up */
for (i=cur; i<=shared_value_abs; i+=step) {
Expand All @@ -462,7 +462,7 @@ gpm_brightness_output_set (GpmBrightness *brightness, RROutput output)

/* some adaptors have a large number of steps */
step = gpm_brightness_get_step (cur - shared_value_abs);
g_debug ("using step of %i", step);
g_debug ("using step of %u", step);

/* going down */
for (i=cur; i>=shared_value_abs; i-=step) {
Expand Down Expand Up @@ -586,7 +586,7 @@ gpm_brightness_set (GpmBrightness *brightness, guint percentage, gboolean *hw_ch
/* can we check the new value with the cache? */
trust_cache = gpm_brightness_trust_cache (brightness);
if (trust_cache && percentage == brightness->priv->cache_percentage) {
g_debug ("not setting the same value %i", percentage);
g_debug ("not setting the same value %u", percentage);
return TRUE;
}

Expand Down Expand Up @@ -656,7 +656,7 @@ gpm_brightness_get (GpmBrightness *brightness, guint *percentage)

/* valid? */
if (percentage_local > 100) {
g_warning ("percentage value of %i will be truncated", percentage_local);
g_warning ("percentage value of %u will be truncated", percentage_local);
percentage_local = 100;
}

Expand Down Expand Up @@ -786,7 +786,7 @@ gpm_brightness_may_have_changed (GpmBrightness *brightness)
g_warning ("failed to get output");
return;
}
g_debug ("emitting brightness-changed (%i)", percentage);
g_debug ("emitting brightness-changed (%u)", percentage);
g_signal_emit (brightness, signals [BRIGHTNESS_CHANGED], 0, percentage);
}

Expand Down
8 changes: 4 additions & 4 deletions src/gpm-button.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ gpm_button_filter_x_events (GdkXEvent *xevent, GdkEvent *event, gpointer data)

/* found anything? */
if (key == NULL) {
g_debug ("Key %i not found in hash", keycode);
g_debug ("Key %u not found in hash", keycode);
/* pass normal keypresses on, which might help with accessibility access */
return GDK_FILTER_CONTINUE;
}

g_debug ("Key %i mapped to key %s", keycode, key);
g_debug ("Key %u mapped to key %s", keycode, key);
gpm_button_emit_type (button, key);

return GDK_FILTER_REMOVE;
Expand Down Expand Up @@ -207,15 +207,15 @@ gpm_button_xevent_key (GpmButton *button, guint keysym, const gchar *key_name)
keycode_str = g_strdup_printf ("0x%x", keycode);
key = g_hash_table_lookup (button->priv->keysym_to_name_hash, (gpointer) keycode_str);
if (key != NULL) {
g_warning ("found in hash %i", keycode);
g_warning ("found in hash %u", keycode);
g_free (keycode_str);
return FALSE;
}

/* try to register X event */
ret = gpm_button_grab_keystring (button, keycode);
if (!ret) {
g_warning ("Failed to grab %i", keycode);
g_warning ("Failed to grab %u", keycode);
g_free (keycode_str);
return FALSE;
}
Expand Down
4 changes: 4 additions & 0 deletions src/gpm-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,12 @@ gpm_notebook_scroll_event_cb (GtkWidget *widget,
else if (event->delta_x < 0)
gtk_notebook_prev_page (notebook);
break;
default:
break;
}
break;
default:
break;
}

return TRUE;
Expand Down
Loading

0 comments on commit 688ec2f

Please sign in to comment.