summaryrefslogtreecommitdiff
path: root/plugins/keyboard/msd-keyboard-xkb.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/keyboard/msd-keyboard-xkb.c')
-rw-r--r--plugins/keyboard/msd-keyboard-xkb.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/plugins/keyboard/msd-keyboard-xkb.c b/plugins/keyboard/msd-keyboard-xkb.c
index 52cc5c9..4373023 100644
--- a/plugins/keyboard/msd-keyboard-xkb.c
+++ b/plugins/keyboard/msd-keyboard-xkb.c
@@ -3,6 +3,7 @@
* Copyright (C) 2001 Udaltsoft
*
* Written by Sergey V. Oudaltsov <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,6 +32,8 @@
#include <gtk/gtk.h>
#include <gio/gio.h>
+#include <libmate-desktop/mate-image-menu-item.h>
+
#include <libmatekbd/matekbd-status.h>
#include <libmatekbd/matekbd-keyboard-drawing.h>
#include <libmatekbd/matekbd-desktop-config.h>
@@ -149,8 +152,7 @@ apply_desktop_settings (void)
matekbd_desktop_config_activate (&current_desktop_config);
show_leds = g_settings_get_boolean (settings_desktop, DUPLICATE_LEDS_KEY);
- for (i = sizeof (indicator_icons) / sizeof (indicator_icons[0]);
- --i >= 0;) {
+ for (i = G_N_ELEMENTS (indicator_icons); --i >= 0;) {
gtk_status_icon_set_visible (indicator_icons[i],
show_leds);
}
@@ -259,7 +261,9 @@ popup_menu_set_group (GtkMenuItem *item G_GNUC_UNUSED,
}
static void
-status_icon_popup_menu_cb (GtkStatusIcon * icon, guint button, guint time)
+status_icon_popup_menu_cb (GtkStatusIcon *status_icon,
+ guint button,
+ guint time)
{
GtkWidget *toplevel;
GdkScreen *screen;
@@ -312,13 +316,11 @@ status_icon_popup_menu_cb (GtkStatusIcon * icon, guint button, guint time)
GtkWidget *img =
gtk_image_new_from_pixbuf (pixbuf);
item =
- gtk_image_menu_item_new_with_label
+ mate_image_menu_item_new_with_label
(*current_name);
gtk_widget_show (img);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM
+ mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM
(item), img);
- gtk_image_menu_item_set_always_show_image
- (GTK_IMAGE_MENU_ITEM (item), TRUE);
g_free (image_file);
}
gtk_widget_show (item);
@@ -330,7 +332,7 @@ status_icon_popup_menu_cb (GtkStatusIcon * icon, guint button, guint time)
gtk_menu_popup (popup_menu, NULL, NULL,
gtk_status_icon_position_menu,
- (gpointer) icon, button, time);
+ (gpointer) status_icon, button, time);
}
static void
@@ -502,8 +504,11 @@ msd_keyboard_xkb_set_post_activation_callback (PostActivationCallback fun,
}
static GdkFilterReturn
-msd_keyboard_xkb_evt_filter (GdkXEvent * xev, GdkEvent * event)
+msd_keyboard_xkb_evt_filter (GdkXEvent *xev,
+ GdkEvent *event,
+ gpointer data)
{
+ (void) data;
XEvent *xevent = (XEvent *) xev;
xkl_engine_filter_events (xkl_engine, xevent);
return GDK_FILTER_CONTINUE;
@@ -535,9 +540,7 @@ msd_keyboard_update_indicator_icons (void)
new_state |= (state ? 1 : 0);
xkl_debug (160, "Indicators state: %d\n", new_state);
-
- for (i = sizeof (indicator_icons) / sizeof (indicator_icons[0]);
- --i >= 0;) {
+ for (i = G_N_ELEMENTS (indicator_icons); --i >= 0;) {
gtk_status_icon_set_from_icon_name (indicator_icons[i],
(new_state & (1 << i))
?
@@ -577,8 +580,7 @@ msd_keyboard_xkb_init (MsdKeyboardManager * kbd_manager)
num_lock = XInternAtom (display, "Num Lock", False);
scroll_lock = XInternAtom (display, "Scroll Lock", False);
- for (i = sizeof (indicator_icons) / sizeof (indicator_icons[0]);
- --i >= 0;) {
+ for (i = G_N_ELEMENTS (indicator_icons); --i >= 0;) {
indicator_icons[i] =
gtk_status_icon_new_from_icon_name
(indicator_off_icon_names[i]);
@@ -617,8 +619,7 @@ msd_keyboard_xkb_init (MsdKeyboardManager * kbd_manager)
g_signal_connect (settings_kbd, "changed",
G_CALLBACK (apply_xkb_settings_cb), NULL);
- gdk_window_add_filter (NULL, (GdkFilterFunc)
- msd_keyboard_xkb_evt_filter, NULL);
+ gdk_window_add_filter (NULL, msd_keyboard_xkb_evt_filter, NULL);
if (xkl_engine_get_features (xkl_engine) &
XKLF_DEVICE_DISCOVERY)
@@ -656,8 +657,7 @@ msd_keyboard_xkb_shutdown (void)
pa_callback_user_data = NULL;
manager = NULL;
- for (i = sizeof (indicator_icons) / sizeof (indicator_icons[0]);
- --i >= 0;) {
+ for (i = G_N_ELEMENTS (indicator_icons); --i >= 0;) {
g_object_unref (G_OBJECT (indicator_icons[i]));
indicator_icons[i] = NULL;
}
@@ -671,8 +671,7 @@ msd_keyboard_xkb_shutdown (void)
XKLL_MANAGE_LAYOUTS |
XKLL_MANAGE_WINDOW_STATES);
- gdk_window_remove_filter (NULL, (GdkFilterFunc)
- msd_keyboard_xkb_evt_filter, NULL);
+ gdk_window_remove_filter (NULL, msd_keyboard_xkb_evt_filter, NULL);
if (settings_desktop != NULL) {
g_object_unref (settings_desktop);