summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2022-07-28 15:54:47 +0200
committerrbuj <[email protected]>2022-07-28 15:54:47 +0200
commit5dfaf3b1e5fde134d4019436db55ee7685e419e2 (patch)
tree70735c4e4edbe066fc8a8a4affb27c8d6716184b
parentcf26de9dbf0decf88f6fcbc62c84efaedd3d77d7 (diff)
downloadlibmatekbd-5dfaf3b1e5fde134d4019436db55ee7685e419e2.tar.bz2
libmatekbd-5dfaf3b1e5fde134d4019436db55ee7685e419e2.tar.xz
Fix some conversion warningsconversion-warnings
-rw-r--r--libmatekbd/matekbd-desktop-config.c6
-rw-r--r--libmatekbd/matekbd-indicator-config.c20
-rw-r--r--libmatekbd/matekbd-indicator-config.h9
-rw-r--r--libmatekbd/matekbd-indicator.c58
-rw-r--r--libmatekbd/matekbd-keyboard-config.c48
-rw-r--r--libmatekbd/matekbd-keyboard-drawing.c98
-rw-r--r--libmatekbd/matekbd-keyboard-drawing.h6
-rw-r--r--libmatekbd/matekbd-status.c45
-rw-r--r--libmatekbd/matekbd-util.c6
-rw-r--r--libmatekbd/org.mate.peripherals-keyboard-xkb.gschema.xml.in2
10 files changed, 142 insertions, 156 deletions
diff --git a/libmatekbd/matekbd-desktop-config.c b/libmatekbd/matekbd-desktop-config.c
index 1d854ff..cb17498 100644
--- a/libmatekbd/matekbd-desktop-config.c
+++ b/libmatekbd/matekbd-desktop-config.c
@@ -277,7 +277,7 @@ matekbd_desktop_config_load_group_descriptions (MatekbdDesktopConfig
gchar **sld, **lld, **svd, **lvd;
gchar **psld, **plld, **plvd;
gchar **psgn, **pfgn, **psvd;
- gint total_descriptions;
+ guint total_descriptions;
if (!matekbd_desktop_config_get_lv_descriptions
(config, registry, layout_ids, variant_ids, &sld, &lld, &svd,
@@ -288,9 +288,9 @@ matekbd_desktop_config_load_group_descriptions (MatekbdDesktopConfig
total_descriptions = g_strv_length (sld);
*short_group_names = psgn =
- g_new0 (gchar *, total_descriptions + 1);
+ g_new0 (gchar *, (gsize) (total_descriptions + 1));
*full_group_names = pfgn =
- g_new0 (gchar *, total_descriptions + 1);
+ g_new0 (gchar *, (gsize) (total_descriptions + 1));
plld = lld;
psld = sld;
diff --git a/libmatekbd/matekbd-indicator-config.c b/libmatekbd/matekbd-indicator-config.c
index 869b26e..8e9fe1d 100644
--- a/libmatekbd/matekbd-indicator-config.c
+++ b/libmatekbd/matekbd-indicator-config.c
@@ -137,10 +137,9 @@ matekbd_indicator_config_refresh_style (MatekbdIndicatorConfig * ind_config)
}
gchar *
-matekbd_indicator_config_get_images_file (MatekbdIndicatorConfig *
- ind_config,
- MatekbdKeyboardConfig *
- kbd_config, int group)
+matekbd_indicator_config_get_images_file (MatekbdIndicatorConfig * ind_config,
+ MatekbdKeyboardConfig * kbd_config,
+ guint group)
{
char *image_file = NULL;
GtkIconInfo *icon_info = NULL;
@@ -192,17 +191,18 @@ matekbd_indicator_config_load_image_filenames (MatekbdIndicatorConfig *
kbd_config)
{
int i;
+ guint max_num_groups;
ind_config->image_filenames = NULL;
if (!ind_config->show_flags)
return;
- for (i = xkl_engine_get_max_num_groups (ind_config->engine);
- --i >= 0;) {
+ max_num_groups = xkl_engine_get_max_num_groups (ind_config->engine);
+ for (i = (int) max_num_groups; --i >= 0;) {
gchar *image_file =
matekbd_indicator_config_get_images_file (ind_config,
kbd_config,
- i);
+ (guint) i);
ind_config->image_filenames =
g_slist_prepend (ind_config->image_filenames,
image_file);
@@ -280,8 +280,8 @@ void
matekbd_indicator_config_load_from_gsettings (MatekbdIndicatorConfig * ind_config)
{
ind_config->secondary_groups_mask =
- g_settings_get_int (ind_config->settings,
- MATEKBD_INDICATOR_CONFIG_KEY_SECONDARIES);
+ g_settings_get_uint (ind_config->settings,
+ MATEKBD_INDICATOR_CONFIG_KEY_SECONDARIES);
ind_config->show_flags =
g_settings_get_boolean (ind_config->settings,
@@ -297,7 +297,7 @@ matekbd_indicator_config_save_to_gsettings (MatekbdIndicatorConfig * ind_config)
{
g_settings_delay (ind_config->settings);
- g_settings_set_int (ind_config->settings,
+ g_settings_set_uint (ind_config->settings,
MATEKBD_INDICATOR_CONFIG_KEY_SECONDARIES,
ind_config->secondary_groups_mask);
g_settings_set_boolean (ind_config->settings,
diff --git a/libmatekbd/matekbd-indicator-config.h b/libmatekbd/matekbd-indicator-config.h
index f942ec9..9af5dee 100644
--- a/libmatekbd/matekbd-indicator-config.h
+++ b/libmatekbd/matekbd-indicator-config.h
@@ -29,7 +29,7 @@
*/
typedef struct _MatekbdIndicatorConfig MatekbdIndicatorConfig;
struct _MatekbdIndicatorConfig {
- int secondary_groups_mask;
+ guint secondary_groups_mask;
gboolean show_flags;
gchar *font_family;
@@ -64,10 +64,9 @@ extern void matekbd_indicator_config_refresh_style (MatekbdIndicatorConfig *
applet_config);
extern gchar
- * matekbd_indicator_config_get_images_file (MatekbdIndicatorConfig *
- applet_config,
- MatekbdKeyboardConfig *
- kbd_config, int group);
+ * matekbd_indicator_config_get_images_file (MatekbdIndicatorConfig * applet_config,
+ MatekbdKeyboardConfig * kbd_config,
+ guint group);
extern void matekbd_indicator_config_load_image_filenames (MatekbdIndicatorConfig
* applet_config,
diff --git a/libmatekbd/matekbd-indicator.c b/libmatekbd/matekbd-indicator.c
index aefdbe7..b67c901 100644
--- a/libmatekbd/matekbd-indicator.c
+++ b/libmatekbd/matekbd-indicator.c
@@ -70,9 +70,9 @@ matekbd_indicator_global_init (void);
static void
matekbd_indicator_global_term (void);
static GtkWidget *
-matekbd_indicator_prepare_drawing (MatekbdIndicator * gki, int group);
+matekbd_indicator_prepare_drawing (MatekbdIndicator * gki, guint group);
static void
-matekbd_indicator_set_current_page_for_group (MatekbdIndicator * gki, int group);
+matekbd_indicator_set_current_page_for_group (MatekbdIndicator * gki, guint group);
static void
matekbd_indicator_set_current_page (MatekbdIndicator * gki);
static void
@@ -86,6 +86,7 @@ void
matekbd_indicator_load_images ()
{
int i;
+ guint max_num_groups;
GSList *image_filename;
globals.images = NULL;
@@ -96,9 +97,8 @@ matekbd_indicator_load_images ()
return;
image_filename = globals.ind_cfg.image_filenames;
-
- for (i = xkl_engine_get_max_num_groups (globals.engine);
- --i >= 0; image_filename = image_filename->next) {
+ max_num_groups = xkl_engine_get_max_num_groups (globals.engine);
+ for (i = (int) max_num_groups; --i >= 0; image_filename = image_filename->next) {
GdkPixbuf *image = NULL;
char *image_file = (char *) image_filename->data;
@@ -112,14 +112,10 @@ matekbd_indicator_load_images ()
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
- _
- ("There was an error loading an image: %s"),
- gerror->
- message);
- g_signal_connect (G_OBJECT (dialog),
- "response",
- G_CALLBACK
- (gtk_widget_destroy),
+ _("There was an error loading an image: %s"),
+ gerror->message);
+ g_signal_connect (G_OBJECT (dialog), "response",
+ G_CALLBACK (gtk_widget_destroy),
NULL);
gtk_window_set_resizable (GTK_WINDOW
@@ -197,8 +193,8 @@ matekbd_indicator_cleanup (MatekbdIndicator * gki)
void
matekbd_indicator_fill (MatekbdIndicator * gki)
{
- int grp;
- int total_groups = xkl_engine_get_num_groups (globals.engine);
+ guint grp;
+ guint total_groups = xkl_engine_get_num_groups (globals.engine);
GtkNotebook *notebook = GTK_NOTEBOOK (gki);
for (grp = 0; grp < total_groups; grp++) {
@@ -276,7 +272,7 @@ draw_flag (GtkWidget * flag, cairo_t * cr, GdkPixbuf * image)
}
gchar *
-matekbd_indicator_extract_layout_name (int group, XklEngine * engine,
+matekbd_indicator_extract_layout_name (guint group, XklEngine * engine,
MatekbdKeyboardConfig * kbd_cfg,
gchar ** short_group_names,
gchar ** full_group_names)
@@ -320,7 +316,7 @@ matekbd_indicator_extract_layout_name (int group, XklEngine * engine,
}
gchar *
-matekbd_indicator_create_label_title (int group, GHashTable ** ln2cnt_map,
+matekbd_indicator_create_label_title (guint group, GHashTable ** ln2cnt_map,
gchar * layout_name)
{
gpointer pcounter = NULL;
@@ -358,7 +354,7 @@ matekbd_indicator_create_label_title (int group, GHashTable ** ln2cnt_map,
}
static GtkWidget *
-matekbd_indicator_prepare_drawing (MatekbdIndicator * gki, int group)
+matekbd_indicator_prepare_drawing (MatekbdIndicator * gki, guint group)
{
gpointer pimage;
GdkPixbuf *image;
@@ -502,10 +498,11 @@ matekbd_indicator_load_group_names (const gchar ** layout_ids,
&globals.short_group_names, &globals.full_group_names)) {
/* We just populate no short names (remain NULL) -
* full names are going to be used anyway */
- gint i, total_groups =
+ gint i;
+ guint total_groups =
xkl_engine_get_num_groups (globals.engine);
globals.full_group_names =
- g_new0 (gchar *, total_groups + 1);
+ g_new0 (gchar *, (gsize) (total_groups + 1));
if (xkl_engine_get_features (globals.engine) &
XKLF_MULTIPLE_LAYOUTS_SUPPORTED) {
@@ -515,7 +512,7 @@ matekbd_indicator_load_group_names (const gchar ** layout_ids,
g_strdup ((char *) *lst);
}
} else {
- for (i = total_groups; --i >= 0;) {
+ for (i = (int) total_groups; --i >= 0;) {
globals.full_group_names[i] =
g_strdup_printf ("Group %d", i);
}
@@ -564,8 +561,7 @@ matekbd_indicator_state_callback (XklEngine * engine,
if (changeType == GROUP_CHANGED) {
ForAllIndicators () {
xkl_debug (200, "do repaint\n");
- matekbd_indicator_set_current_page_for_group
- (gki, group);
+ matekbd_indicator_set_current_page_for_group (gki, (guint) group);
}
NextIndicator ();
}
@@ -577,17 +573,15 @@ matekbd_indicator_set_current_page (MatekbdIndicator * gki)
XklState *cur_state;
cur_state = xkl_engine_get_current_state (globals.engine);
if (cur_state->group >= 0)
- matekbd_indicator_set_current_page_for_group (gki,
- cur_state->
- group);
+ matekbd_indicator_set_current_page_for_group (gki, (guint) cur_state->group);
}
void
-matekbd_indicator_set_current_page_for_group (MatekbdIndicator * gki, int group)
+matekbd_indicator_set_current_page_for_group (MatekbdIndicator * gki, guint group)
{
- xkl_debug (200, "Revalidating for group %d\n", group);
+ xkl_debug (200, "Revalidating for group %u\n", group);
- gtk_notebook_set_current_page (GTK_NOTEBOOK (gki), group + 1);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (gki), (gint) group + 1);
matekbd_indicator_update_tooltips (gki);
}
@@ -898,9 +892,9 @@ matekbd_indicator_get_max_width_height_ratio (void)
return 0;
while (ip != NULL) {
GdkPixbuf *img = GDK_PIXBUF (ip->data);
- gdouble r =
- 1.0 * gdk_pixbuf_get_width (img) /
- gdk_pixbuf_get_height (img);
+ int width = gdk_pixbuf_get_width (img);
+ int height = gdk_pixbuf_get_height (img);
+ gdouble r = ((gdouble) width) / ((gdouble) height);
if (r > rv)
rv = r;
ip = ip->next;
diff --git a/libmatekbd/matekbd-keyboard-config.c b/libmatekbd/matekbd-keyboard-config.c
index 7338e28..09982d5 100644
--- a/libmatekbd/matekbd-keyboard-config.c
+++ b/libmatekbd/matekbd-keyboard-config.c
@@ -153,7 +153,7 @@ matekbd_keyboard_config_split_items (const gchar * merged, gchar ** parent,
{
static gchar pbuffer[XKL_MAX_CI_NAME_LENGTH];
static gchar cbuffer[XKL_MAX_CI_NAME_LENGTH];
- int plen;
+ size_t plen;
const gchar *pos;
*parent = *child = NULL;
@@ -164,7 +164,7 @@ matekbd_keyboard_config_split_items (const gchar * merged, gchar ** parent,
if (pos == NULL) {
plen = strlen (merged);
} else {
- plen = pos - merged;
+ plen = (size_t) (pos - merged);
if (strlen (pos + 1) >= XKL_MAX_CI_NAME_LENGTH)
return FALSE;
strcpy (*child = cbuffer, pos + 1);
@@ -224,11 +224,9 @@ matekbd_keyboard_config_copy_from_xkl_config (MatekbdKeyboardConfig * kbd_config
char *option = *p;
char *delim =
(option != NULL) ? strchr (option, ':') : NULL;
- int len;
+ size_t len;
if ((delim != NULL) &&
- ((len =
- (delim - option)) <
- XKL_MAX_CI_NAME_LENGTH)) {
+ ((len = (size_t) (delim - option)) < XKL_MAX_CI_NAME_LENGTH)) {
strncpy (group, option, len);
group[len] = 0;
xkl_debug (150,
@@ -247,26 +245,26 @@ matekbd_keyboard_config_copy_to_xkl_config (MatekbdKeyboardConfig * kbd_config,
XklConfigRec * pdata)
{
int i;
- int num_layouts, num_options;
+ guint num_layouts, num_options;
pdata->model =
- (kbd_config->model ==
- NULL) ? NULL : g_strdup (kbd_config->model);
+ (kbd_config->model == NULL) ?
+ NULL : g_strdup (kbd_config->model);
num_layouts =
- (kbd_config->layouts_variants ==
- NULL) ? 0 : g_strv_length (kbd_config->layouts_variants);
+ (kbd_config->layouts_variants == NULL) ?
+ 0 : g_strv_length (kbd_config->layouts_variants);
num_options =
- (kbd_config->options ==
- NULL) ? 0 : g_strv_length (kbd_config->options);
+ (kbd_config->options == NULL) ?
+ 0 : g_strv_length (kbd_config->options);
xkl_debug (150, "Taking %d layouts\n", num_layouts);
if (num_layouts != 0) {
gchar **the_layout_variant = kbd_config->layouts_variants;
char **p1 = pdata->layouts =
- g_new0 (char *, num_layouts + 1);
+ g_new0 (char *, (gsize) (num_layouts + 1));
char **p2 = pdata->variants =
- g_new0 (char *, num_layouts + 1);
- for (i = num_layouts; --i >= 0;) {
+ g_new0 (char *, (gsize) (num_layouts + 1));
+ for (i = (int) num_layouts; --i >= 0;) {
char *layout, *variant;
if (matekbd_keyboard_config_split_items
(*the_layout_variant, &layout, &variant)
@@ -299,7 +297,7 @@ matekbd_keyboard_config_copy_to_xkl_config (MatekbdKeyboardConfig * kbd_config,
gchar **the_option = kbd_config->options;
char **p = pdata->options =
g_new0 (char *, num_options + 1);
- for (i = num_options; --i >= 0;) {
+ for (i = (int) num_options; --i >= 0;) {
char *group, *option;
if (matekbd_keyboard_config_split_items
(*the_option, &group, &option)
@@ -496,24 +494,24 @@ static gboolean
matekbd_keyboard_config_options_equals (MatekbdKeyboardConfig * kbd_config1,
MatekbdKeyboardConfig * kbd_config2)
{
- int num_options, num_options2;
+ guint num_options, num_options2;
num_options =
- (kbd_config1->options ==
- NULL) ? 0 : g_strv_length (kbd_config1->options);
+ (kbd_config1->options == NULL) ?
+ 0 : g_strv_length (kbd_config1->options);
num_options2 =
- (kbd_config2->options ==
- NULL) ? 0 : g_strv_length (kbd_config2->options);
+ (kbd_config2->options == NULL) ?
+ 0 : g_strv_length (kbd_config2->options);
if (num_options != num_options2)
return False;
if (num_options != 0) {
- int i;
+ guint i;
char *group1, *option1;
for (i = 0; i < num_options; i++) {
- int j;
+ guint j;
char *group2, *option2;
gboolean are_equal = FALSE;
@@ -697,7 +695,7 @@ matekbd_keyboard_config_to_string (const MatekbdKeyboardConfig * config)
GString *buffer = g_string_new (NULL);
gchar **iter;
- gint count;
+ unsigned long count;
gchar *result;
if (config->layouts_variants) {
diff --git a/libmatekbd/matekbd-keyboard-drawing.c b/libmatekbd/matekbd-keyboard-drawing.c
index 053eded..69fc4b1 100644
--- a/libmatekbd/matekbd-keyboard-drawing.c
+++ b/libmatekbd/matekbd-keyboard-drawing.c
@@ -59,7 +59,7 @@ extern void xkl_xkb_config_native_cleanup (XklEngine * engine,
static gint
xkb_to_pixmap_coord (MatekbdKeyboardDrawingRenderContext * context, gint n)
{
- return n * context->scale_numerator / context->scale_denominator;
+ return (gint) (((gdouble) n) * context->scale_numerator / context->scale_denominator);
}
static gdouble
@@ -75,16 +75,14 @@ static void
rotate_coordinate (gint origin_x,
gint origin_y,
gint x,
- gint y, gint angle, gint * rotated_x, gint * rotated_y)
+ gint y, gdouble angle, gint * rotated_x, gint * rotated_y)
{
- *rotated_x =
- origin_x + (x - origin_x) * cos (M_PI * angle / 1800.0) - (y -
- origin_y)
- * sin (M_PI * angle / 1800.0);
- *rotated_y =
- origin_y + (x - origin_x) * sin (M_PI * angle / 1800.0) + (y -
- origin_y)
- * cos (M_PI * angle / 1800.0);
+ *rotated_x = origin_x +
+ (gint) ((cos (M_PI * angle / 1800.0) * (double) (x - origin_x)) -
+ (sin (M_PI * angle / 1800.0) * (double) (y - origin_y)));
+ *rotated_y = origin_y +
+ (gint) ((sin (M_PI * angle / 1800.0) * (double) (x - origin_x)) +
+ (cos (M_PI * angle / 1800.0) * (double) (y - origin_y)));
}
static gdouble
@@ -339,7 +337,7 @@ curve_rectangle (cairo_t * cr,
{
gdouble x1, y1;
- if (!width || !height)
+ if (width == .0 || height == .0)
return;
x1 = x0 + width;
@@ -365,7 +363,7 @@ static void
draw_curve_rectangle (cairo_t * cr,
gboolean filled,
GdkRGBA * fill_color,
- gint x, gint y, gint width, gint height, gint radius)
+ gint x, gint y, gint width, gint height, gdouble radius)
{
curve_rectangle (cr, x, y, width, height, radius);
@@ -383,7 +381,7 @@ draw_rectangle (MatekbdKeyboardDrawingRenderContext * context,
GdkRGBA * fill_color,
gint angle,
gint xkb_x, gint xkb_y, gint xkb_width, gint xkb_height,
- gint radius)
+ gdouble radius)
{
if (angle == 0) {
gint x, y, width, height;
@@ -447,7 +445,7 @@ draw_outline (MatekbdKeyboardDrawingRenderContext * context,
draw_rectangle (context, color, angle, origin_x,
origin_y, outline->points[0].x,
outline->points[0].y,
- outline->corner_radius);
+ (gdouble) outline->corner_radius);
#ifdef KBDRAW_DEBUG
printf ("pointsxy:%d %d %d\n", outline->points[0].x,
@@ -457,7 +455,7 @@ draw_outline (MatekbdKeyboardDrawingRenderContext * context,
draw_rectangle (context, NULL, angle, origin_x, origin_y,
outline->points[0].x,
outline->points[0].y,
- outline->corner_radius);
+ (gdouble) outline->corner_radius);
} else if (outline->num_points == 2) {
gint rotated_x0, rotated_y0;
@@ -469,12 +467,12 @@ draw_outline (MatekbdKeyboardDrawingRenderContext * context,
draw_rectangle (context, color, angle, rotated_x0,
rotated_y0, outline->points[1].x,
outline->points[1].y,
- outline->corner_radius);
+ (gdouble) outline->corner_radius);
draw_rectangle (context, NULL, angle, rotated_x0,
rotated_y0, outline->points[1].x,
outline->points[1].y,
- outline->corner_radius);
+ (gdouble) outline->corner_radius);
} else {
if (color)
draw_polygon (context, color, origin_x, origin_y,
@@ -497,9 +495,9 @@ parse_xkb_color_spec (gchar * colorspec, GdkRGBA * color)
color->alpha = 1.0;
if (g_ascii_strcasecmp (colorspec, "black") == 0) {
- color->red = 0;
- color->green = 0;
- color->blue = 0;
+ color->red = 0.;
+ color->green = 0.;
+ color->blue = 0.;
} else if (g_ascii_strcasecmp (colorspec, "white") == 0) {
color->red = 1.0;
color->green = 1.0;
@@ -508,39 +506,39 @@ parse_xkb_color_spec (gchar * colorspec, GdkRGBA * color)
g_ascii_strncasecmp (colorspec, "gray", 4) == 0) {
level = strtol (colorspec + 4, NULL, 10);
- color->red = 1.0 - 1.0 * level / 100.0;
- color->green = 1.0 - 1.0 * level / 100.0;
- color->blue = 1.0 - 1.0 * level / 100.0;
+ color->red = 1.0 - 1.0 * ((gdouble) level) / 100.0;
+ color->green = 1.0 - 1.0 * ((gdouble) level) / 100.0;
+ color->blue = 1.0 - 1.0 * ((gdouble) level) / 100.0;
} else if (g_ascii_strcasecmp (colorspec, "red") == 0) {
color->red = 1.0;
- color->green = 0;
- color->blue = 0;
+ color->green = 0.;
+ color->blue = 0.;
} else if (g_ascii_strcasecmp (colorspec, "green") == 0) {
- color->red = 0;
+ color->red = 0.;
color->green = 1.0;
- color->blue = 0;
+ color->blue = 0.;
} else if (g_ascii_strcasecmp (colorspec, "blue") == 0) {
- color->red = 0;
- color->green = 0;
+ color->red = 0.;
+ color->green = 0.;
color->blue = 1.0;
} else if (g_ascii_strncasecmp (colorspec, "red", 3) == 0) {
level = strtol (colorspec + 3, NULL, 10);
- color->red = 1.0 * level / 100.0;
- color->green = 0;
- color->blue = 0;
+ color->red = 1.0 * ((gdouble) level) / 100.0;
+ color->green = 0.;
+ color->blue = 0.;
} else if (g_ascii_strncasecmp (colorspec, "green", 5) == 0) {
level = strtol (colorspec + 5, NULL, 10);
- color->red = 0;
- color->green = 1.0 * level / 100.0;
- color->blue = 0;
+ color->red = 0.;
+ color->green = 1.0 * ((gdouble) level) / 100.0;
+ color->blue = 0.;
} else if (g_ascii_strncasecmp (colorspec, "blue", 4) == 0) {
level = strtol (colorspec + 4, NULL, 10);
- color->red = 0;
- color->green = 0;
- color->blue = 1.0 * level / 100.0;
+ color->red = 0.;
+ color->green = 0.;
+ color->blue = 1.0 * ((gdouble) level) / 100.0;
} else
return FALSE;
@@ -1103,7 +1101,7 @@ draw_key_label_helper (MatekbdKeyboardDrawingRenderContext * context,
default:
return;
}
- set_key_label_in_layout (context, keysym);
+ set_key_label_in_layout (context, (guint) keysym);
pango_layout_set_width (context->layout, label_max_width);
label_y -= (pango_layout_get_line_count (context->layout) - 1) *
(pango_font_description_get_size (context->font_desc) /
@@ -1131,7 +1129,7 @@ draw_key_label (MatekbdKeyboardDrawingRenderContext * context,
if (!drawing->xkb)
return;
- padding = 23 * context->scale_numerator / context->scale_denominator; /* 2.3mm */
+ padding = (gint) (23.0 * context->scale_numerator / context->scale_denominator); /* 2.3mm */
x = xkb_to_pixmap_coord (context, xkb_origin_x);
y = xkb_to_pixmap_coord (context, xkb_origin_y);
@@ -1703,12 +1701,12 @@ context_setup_scaling (MatekbdKeyboardDrawingRenderContext * context,
}
pango_font_description_set_size (context->font_desc,
- 72 * KEY_FONT_SIZE * dpi_x *
- context->scale_numerator /
- context->scale_denominator);
+ (gint) (72.0 * KEY_FONT_SIZE * dpi_x *
+ context->scale_numerator /
+ context->scale_denominator));
pango_layout_set_spacing (context->layout,
- -160 * dpi_y * context->scale_numerator /
- context->scale_denominator);
+ (int) (-160.0 * dpi_y * context->scale_numerator /
+ context->scale_denominator));
pango_layout_set_font_description (context->layout,
context->font_desc);
@@ -2818,21 +2816,21 @@ matekbd_keyboard_drawing_new_dialog (gint group, gchar * group_name)
xkl_data = xkl_config_rec_new ();
if (xkl_config_rec_get_from_server (xkl_data, engine)) {
- int num_layouts = g_strv_length (xkl_data->layouts);
- int num_variants = g_strv_length (xkl_data->variants);
+ guint num_layouts = g_strv_length (xkl_data->layouts);
+ guint num_variants = g_strv_length (xkl_data->variants);
if (group >= 0 && group < num_layouts
&& group < num_variants) {
char *l = g_strdup (xkl_data->layouts[group]);
char *v = g_strdup (xkl_data->variants[group]);
char **p;
- int i;
+ gint i;
if ((p = xkl_data->layouts) != NULL)
- for (i = num_layouts; --i >= 0;)
+ for (i = (gint) num_layouts; --i >= 0;)
g_free (*p++);
if ((p = xkl_data->variants) != NULL)
- for (i = num_variants; --i >= 0;)
+ for (i = (gint) num_variants; --i >= 0;)
g_free (*p++);
xkl_data->layouts =
diff --git a/libmatekbd/matekbd-keyboard-drawing.h b/libmatekbd/matekbd-keyboard-drawing.h
index 3c79785..474a055 100644
--- a/libmatekbd/matekbd-keyboard-drawing.h
+++ b/libmatekbd/matekbd-keyboard-drawing.h
@@ -114,8 +114,8 @@ struct _MatekbdKeyboardDrawingRenderContext {
PangoLayout *layout;
PangoFontDescription *font_desc;
- gint scale_numerator;
- gint scale_denominator;
+ gdouble scale_numerator;
+ gdouble scale_denominator;
GdkRGBA dark_color;
};
@@ -153,7 +153,7 @@ struct _MatekbdKeyboardDrawing {
gint xkb_event_type;
MatekbdKeyboardDrawingDoodad **physical_indicators;
- gint physical_indicators_size;
+ unsigned long physical_indicators_size;
guint track_config:1;
guint track_modifiers:1;
diff --git a/libmatekbd/matekbd-status.c b/libmatekbd/matekbd-status.c
index 68c15dc..2243fb6 100644
--- a/libmatekbd/matekbd-status.c
+++ b/libmatekbd/matekbd-status.c
@@ -85,9 +85,9 @@ matekbd_status_global_init (void);
static void
matekbd_status_global_term (void);
static GdkPixbuf *
-matekbd_status_prepare_drawing (MatekbdStatus * gki, int group);
+matekbd_status_prepare_drawing (MatekbdStatus * gki, guint group);
static void
-matekbd_status_set_current_page_for_group (MatekbdStatus * gki, int group);
+matekbd_status_set_current_page_for_group (MatekbdStatus * gki, guint group);
static void
matekbd_status_set_current_page (MatekbdStatus * gki);
static void
@@ -119,8 +119,8 @@ matekbd_status_global_cleanup (MatekbdStatus * gki)
void
matekbd_status_global_fill (MatekbdStatus * gki)
{
- int grp;
- int total_groups = xkl_engine_get_num_groups (globals.engine);
+ guint grp;
+ guint total_groups = xkl_engine_get_num_groups (globals.engine);
for (grp = 0; grp < total_groups; grp++) {
GdkPixbuf *page = matekbd_status_prepare_drawing (gki, grp);
@@ -136,7 +136,7 @@ matekbd_status_activate (MatekbdStatus * gki)
}
/* hackish xref */
-extern gchar *matekbd_indicator_extract_layout_name (int group,
+extern gchar *matekbd_indicator_extract_layout_name (guint group,
XklEngine * engine,
MatekbdKeyboardConfig *
kbd_cfg,
@@ -145,13 +145,13 @@ extern gchar *matekbd_indicator_extract_layout_name (int group,
gchar **
full_group_names);
-extern gchar *matekbd_indicator_create_label_title (int group,
+extern gchar *matekbd_indicator_create_label_title (guint group,
GHashTable **
ln2cnt_map,
gchar * layout_name);
static void
-matekbd_status_render_cairo (cairo_t * cr, int group)
+matekbd_status_render_cairo (cairo_t * cr, guint group)
{
double r, g, b;
PangoFontDescription *pfd;
@@ -163,7 +163,7 @@ matekbd_status_render_cairo (cairo_t * cr, int group)
cairo_font_options_t *fo;
static GHashTable *ln2cnt_map = NULL;
- xkl_debug (160, "Rendering cairo for group %d\n", group);
+ xkl_debug (160, "Rendering cairo for group %u\n", group);
if (globals.ind_cfg.background_color != NULL &&
globals.ind_cfg.background_color[0] != 0) {
if (sscanf
@@ -285,7 +285,7 @@ convert_bgra_to_rgba (guint8 const *src, guint8 * dst, int width,
}
static GdkPixbuf *
-matekbd_status_prepare_drawing (MatekbdStatus * gki, int group)
+matekbd_status_prepare_drawing (MatekbdStatus * gki, guint group)
{
GError *gerror = NULL;
char *image_filename;
@@ -332,7 +332,7 @@ matekbd_status_prepare_drawing (MatekbdStatus * gki, int group)
return NULL;
}
xkl_debug (150,
- "Image %d[%s] loaded -> %p[%dx%d], alpha: %d\n",
+ "Image %u[%s] loaded -> %p[%dx%d], alpha: %d\n",
group, image_filename, image,
gdk_pixbuf_get_width (image),
gdk_pixbuf_get_height (image),
@@ -350,13 +350,11 @@ matekbd_status_prepare_drawing (MatekbdStatus * gki, int group)
cairo_data = cairo_image_surface_get_data (cs);
#if 0
char pngfilename[20];
- g_sprintf (pngfilename, "label%d.png", group);
+ g_sprintf (pngfilename, "label%u.png", group);
cairo_surface_write_to_png (cs, pngfilename);
#endif
pixbuf_data =
- g_new0 (guchar,
- 4 * globals.real_width *
- globals.current_height);
+ g_new0 (guchar, (gsize) (4 * globals.real_width * globals.current_height));
convert_bgra_to_rgba (cairo_data, pixbuf_data,
globals.current_width,
globals.current_height,
@@ -375,7 +373,7 @@ matekbd_status_prepare_drawing (MatekbdStatus * gki, int group)
(GdkPixbufDestroyNotify)
g_free, NULL);
xkl_debug (150,
- "Image %d created -> %p[%dx%d], alpha: %d\n",
+ "Image %u created -> %p[%dx%d], alpha: %d\n",
group, image, gdk_pixbuf_get_width (image),
gdk_pixbuf_get_height (image),
gdk_pixbuf_get_has_alpha (image));
@@ -455,12 +453,13 @@ matekbd_status_load_group_names (const gchar ** layout_ids,
&globals.short_group_names, &globals.full_group_names)) {
/* We just populate no short names (remain NULL) -
* full names are going to be used anyway */
- gint i, total_groups =
+ gint i;
+ guint total_groups =
xkl_engine_get_num_groups (globals.engine);
xkl_debug (150, "group descriptions loaded: %d!\n",
total_groups);
globals.full_group_names =
- g_new0 (char *, total_groups + 1);
+ g_new0 (char *, (gsize) (total_groups + 1));
if (xkl_engine_get_features (globals.engine) &
XKLF_MULTIPLE_LAYOUTS_SUPPORTED) {
@@ -470,7 +469,7 @@ matekbd_status_load_group_names (const gchar ** layout_ids,
g_strdup ((char *) *lst);
}
} else {
- for (i = total_groups; --i >= 0;) {
+ for (i = (int) total_groups; --i >= 0;) {
globals.full_group_names[i] =
g_strdup_printf ("Group %d", i);
}
@@ -514,15 +513,14 @@ matekbd_status_kbd_cfg_callback (MatekbdStatus * gki)
static void
matekbd_status_state_callback (XklEngine * engine,
XklEngineStateChange changeType,
- gint group, gboolean restore)
+ int group, gboolean restore)
{
xkl_debug (150, "group is now %d, restore: %d\n", group, restore);
if (changeType == GROUP_CHANGED) {
ForAllIndicators () {
xkl_debug (200, "do repaint\n");
- matekbd_status_set_current_page_for_group (gki,
- group);
+ matekbd_status_set_current_page_for_group (gki, (guint) group);
}
NextIndicator ();
}
@@ -534,12 +532,11 @@ matekbd_status_set_current_page (MatekbdStatus * gki)
XklState *cur_state;
cur_state = xkl_engine_get_current_state (globals.engine);
if (cur_state->group >= 0)
- matekbd_status_set_current_page_for_group (gki,
- cur_state->group);
+ matekbd_status_set_current_page_for_group (gki, (guint) cur_state->group);
}
void
-matekbd_status_set_current_page_for_group (MatekbdStatus * gki, int group)
+matekbd_status_set_current_page_for_group (MatekbdStatus * gki, guint group)
{
xkl_debug (200, "Revalidating for group %d\n", group);
diff --git a/libmatekbd/matekbd-util.c b/libmatekbd/matekbd-util.c
index 7cb09ca..d8c0056 100644
--- a/libmatekbd/matekbd-util.c
+++ b/libmatekbd/matekbd-util.c
@@ -120,10 +120,10 @@ matekbd_preview_save_position (GdkRectangle * rect)
gchar **
matekbd_strv_append (gchar ** arr, gchar * element)
{
- gint old_length = (arr == NULL) ? 0 : g_strv_length (arr);
- gchar **new_arr = g_new0 (gchar *, old_length + 2);
+ guint old_length = (arr == NULL) ? 0 : g_strv_length (arr);
+ gchar **new_arr = g_new0 (gchar *, (gsize) (old_length + 2));
if (arr != NULL) {
- memcpy (new_arr, arr, old_length * sizeof (gchar *));
+ memcpy (new_arr, arr, ((size_t) old_length) * sizeof (gchar *));
g_free (arr);
}
new_arr[old_length] = element;
diff --git a/libmatekbd/org.mate.peripherals-keyboard-xkb.gschema.xml.in b/libmatekbd/org.mate.peripherals-keyboard-xkb.gschema.xml.in
index abbe803..f8b3a41 100644
--- a/libmatekbd/org.mate.peripherals-keyboard-xkb.gschema.xml.in
+++ b/libmatekbd/org.mate.peripherals-keyboard-xkb.gschema.xml.in
@@ -97,7 +97,7 @@
</key>
</schema>
<schema id="org.mate.peripherals-keyboard-xkb.indicator" path="/org/mate/desktop/peripherals/keyboard/indicator/">
- <key name="secondary" type="i">
+ <key name="secondary" type="u">
<default>0</default>
<summary>Secondary groups</summary>
<description>Secondary groups</description>