summaryrefslogtreecommitdiff
path: root/applets
diff options
context:
space:
mode:
Diffstat (limited to 'applets')
-rw-r--r--applets/clock/clock-location.c61
-rw-r--r--applets/clock/clock.c18
-rw-r--r--applets/clock/system-timezone.c28
-rw-r--r--applets/fish/fish.c59
-rw-r--r--applets/notification_area/main.c4
-rw-r--r--applets/notification_area/status-notifier/org.kde.StatusNotifierItem.xml10
-rw-r--r--applets/notification_area/status-notifier/sn-item-v0.c34
-rw-r--r--applets/wncklet/Makefile.am2
-rw-r--r--applets/wncklet/showdesktop.c8
-rw-r--r--applets/wncklet/wayland-backend.c5
-rw-r--r--applets/wncklet/window-list.c139
-rw-r--r--applets/wncklet/window-list.ui20
-rw-r--r--applets/wncklet/window-menu.c8
-rw-r--r--applets/wncklet/workspace-switcher.c26
14 files changed, 221 insertions, 201 deletions
diff --git a/applets/clock/clock-location.c b/applets/clock/clock-location.c
index 9dc25e4b..7ce1c129 100644
--- a/applets/clock/clock-location.c
+++ b/applets/clock/clock-location.c
@@ -210,35 +210,17 @@ clock_location_finalize (GObject *g_obj)
G_CALLBACK (network_changed),
CLOCK_LOCATION (g_obj));
- if (priv->name) {
- g_free (priv->name);
- priv->name = NULL;
- }
-
- if (priv->city) {
- g_free (priv->city);
- priv->city = NULL;
- }
+ g_free (priv->name);
+ g_free (priv->city);
if (priv->systz) {
g_object_unref (priv->systz);
priv->systz = NULL;
}
- if (priv->timezone) {
- g_free (priv->timezone);
- priv->timezone = NULL;
- }
-
- if (priv->tzname) {
- g_free (priv->tzname);
- priv->tzname = NULL;
- }
-
- if (priv->weather_code) {
- g_free (priv->weather_code);
- priv->weather_code = NULL;
- }
+ g_free (priv->timezone);
+ g_free (priv->tzname);
+ g_free (priv->weather_code);
if (priv->weather_info) {
weather_info_free (priv->weather_info);
@@ -277,11 +259,7 @@ clock_location_set_name (ClockLocation *loc, const gchar *name)
{
ClockLocationPrivate *priv = clock_location_get_instance_private (loc);
- if (priv->name) {
- g_free (priv->name);
- priv->name = NULL;
- }
-
+ g_free (priv->name);
priv->name = g_strdup (name);
}
@@ -298,11 +276,7 @@ clock_location_set_city (ClockLocation *loc, const gchar *city)
{
ClockLocationPrivate *priv = clock_location_get_instance_private (loc);
- if (priv->city) {
- g_free (priv->city);
- priv->city = NULL;
- }
-
+ g_free (priv->city);
priv->city = g_strdup (city);
}
@@ -319,11 +293,7 @@ clock_location_set_timezone (ClockLocation *loc, const gchar *timezone)
{
ClockLocationPrivate *priv = clock_location_get_instance_private (loc);
- if (priv->timezone) {
- g_free (priv->timezone);
- priv->timezone = NULL;
- }
-
+ g_free (priv->timezone);
priv->timezone = g_strdup (timezone);
}
@@ -360,16 +330,11 @@ clock_location_set_tzname (ClockLocation *this, const char *tzname)
{
ClockLocationPrivate *priv = clock_location_get_instance_private (CLOCK_LOCATION(this));
- if (priv->tzname) {
- if (strcmp (priv->tzname, tzname) == 0) {
- return;
- }
-
- g_free (priv->tzname);
- priv->tzname = NULL;
- }
+ if (priv->tzname && strcmp (priv->tzname, tzname) == 0)
+ return;
- if (tzname) {
+ g_free (priv->tzname);
+ if (tzname && *tzname != '\0') {
priv->tzname = g_strdup (tzname);
} else {
priv->tzname = NULL;
@@ -596,7 +561,7 @@ clock_location_make_current (ClockLocation *loc,
static gchar *
clock_location_get_valid_weather_code (const gchar *code)
{
- if (!code || code[0] == '\0')
+ if (!code || *code == '\0')
return g_strdup (WEATHER_EMPTY_CODE);
else
return g_strdup (code);
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index 28b28ac7..f3c18d27 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -499,8 +499,7 @@ get_updated_timeformat (ClockData *cd)
static void
update_timeformat (ClockData *cd)
{
- if (cd->timeformat)
- g_free (cd->timeformat);
+ g_free (cd->timeformat);
cd->timeformat = get_updated_timeformat (cd);
}
@@ -2400,17 +2399,17 @@ show_week_changed (GSettings *settings,
static void
setup_gsettings (ClockData *cd)
{
+ gint format;
+ gchar *custom_format;
+
cd->settings = mate_panel_applet_settings_new (MATE_PANEL_APPLET (cd->applet), CLOCK_SCHEMA);
/* hack to allow users to set custom format in dconf-editor */
- gint format;
- gchar *custom_format;
format = g_settings_get_enum (cd->settings, KEY_FORMAT);
custom_format = g_settings_get_string (cd->settings, KEY_CUSTOM_FORMAT);
g_settings_set_enum (cd->settings, KEY_FORMAT, format);
g_settings_set_string (cd->settings, KEY_CUSTOM_FORMAT, custom_format);
- if (custom_format != NULL)
- g_free (custom_format);
+ g_free (custom_format);
g_signal_connect (cd->settings, "changed::" KEY_FORMAT, G_CALLBACK (format_changed), cd);
g_signal_connect (cd->settings, "changed::" KEY_SHOW_SECONDS, G_CALLBACK (show_seconds_changed), cd);
@@ -2528,9 +2527,6 @@ fill_clock_applet (MatePanelApplet *applet)
G_CALLBACK (panel_button_change_pixel_size),
cd);
- mate_panel_applet_set_background_widget (MATE_PANEL_APPLET (cd->applet),
- GTK_WIDGET (cd->applet));
-
action_group = gtk_action_group_new ("ClockApplet Menu Actions");
gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions (action_group,
@@ -3401,12 +3397,12 @@ static void display_about_dialog(GtkAction* action, ClockData* cd)
"authors", authors,
"comments", _("The Clock displays the current time and date"),
"copyright", _("Copyright \xc2\xa9 1998-2004 Free Software Foundation, Inc.\n"
- "Copyright \xc2\xa9 2012-2020 MATE developers"),
+ "Copyright \xc2\xa9 2012-2021 MATE developers"),
"documenters", documenters,
"logo-icon-name", CLOCK_ICON,
"translator-credits", _("translator-credits"),
"version", VERSION,
- "website", "http://mate-desktop.org/",
+ "website", PACKAGE_URL,
NULL);
}
diff --git a/applets/clock/system-timezone.c b/applets/clock/system-timezone.c
index b1755aa9..199756e0 100644
--- a/applets/clock/system-timezone.c
+++ b/applets/clock/system-timezone.c
@@ -234,15 +234,8 @@ system_timezone_finalize (GObject *obj)
systz = SYSTEM_TIMEZONE (obj);
priv = system_timezone_get_instance_private (systz);
- if (priv->tz) {
- g_free (priv->tz);
- priv->tz = NULL;
- }
-
- if (priv->env_tz) {
- g_free (priv->env_tz);
- priv->env_tz = NULL;
- }
+ g_free (priv->tz);
+ g_free (priv->env_tz);
for (i = 0; i < CHECK_NB; i++) {
if (priv->monitors[i])
@@ -265,9 +258,10 @@ system_timezone_monitor_changed (GFileMonitor *handle,
gpointer user_data)
{
SystemTimezonePrivate *priv;
- priv = system_timezone_get_instance_private (user_data);
char *new_tz;
+ priv = system_timezone_get_instance_private (user_data);
+
if (event != G_FILE_MONITOR_EVENT_CHANGED &&
event != G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT &&
event != G_FILE_MONITOR_EVENT_DELETED &&
@@ -280,13 +274,13 @@ system_timezone_monitor_changed (GFileMonitor *handle,
if (strcmp (priv->tz, new_tz) != 0) {
g_free (priv->tz);
- priv->tz = new_tz;
+ priv->tz = g_strdup (new_tz);
g_signal_emit (G_OBJECT (user_data),
system_timezone_signals[CHANGED],
0, priv->tz);
- } else
- g_free (new_tz);
+ }
+ g_free (new_tz);
}
@@ -413,16 +407,12 @@ system_timezone_read_key_file (const char *filename,
if (value[0] == '\"') {
if (value[len - 1] == '\"') {
- if (retval)
- g_free (retval);
-
+ g_free (retval);
retval = g_strndup (value + 1,
len - 2);
}
} else {
- if (retval)
- g_free (retval);
-
+ g_free (retval);
retval = g_strdup (line + strlen (key_eq));
}
diff --git a/applets/fish/fish.c b/applets/fish/fish.c
index d77db1d9..ac6cdcb8 100644
--- a/applets/fish/fish.c
+++ b/applets/fish/fish.c
@@ -27,7 +27,6 @@
#include <config.h>
-#include <math.h>
#include <string.h>
#include <time.h>
@@ -212,7 +211,8 @@ static void name_value_changed(GtkEntry* entry, FishApplet* fish)
}
static void image_value_changed(GtkFileChooser* chooser, FishApplet* fish)
-{ char *path;
+{
+ char *path;
char *image;
char *path_gsettings;
@@ -468,7 +468,7 @@ static void display_preferences_dialog(GtkAction* action, FishApplet* fish)
gtk_spin_button_set_value (GTK_SPIN_BUTTON (fish->frames_spin),
fish->n_frames);
- g_signal_connect (fish->frames_spin, "value_changed",
+ g_signal_connect (fish->frames_spin, "value-changed",
G_CALLBACK (n_frames_value_changed), fish);
setup_sensitivity (fish, builder,
@@ -480,7 +480,7 @@ static void display_preferences_dialog(GtkAction* action, FishApplet* fish)
fish->speed_spin = GTK_WIDGET (gtk_builder_get_object (builder, "speed_spin"));
gtk_spin_button_set_value (GTK_SPIN_BUTTON (fish->speed_spin), fish->speed);
- g_signal_connect (fish->speed_spin, "value_changed",
+ g_signal_connect (fish->speed_spin, "value-changed",
G_CALLBACK (speed_value_changed), fish);
setup_sensitivity (fish, builder,
@@ -557,12 +557,12 @@ static void display_about_dialog(GtkAction* action, FishApplet* fish)
"comments", descr,
"copyright", _("Copyright \xc2\xa9 1998-2002 Free Software Foundation, Inc.\n"
"Copyright \xc2\xa9 2002-2005 Vincent Untz\n"
- "Copyright \xc2\xa9 2012-2020 MATE developers"),
+ "Copyright \xc2\xa9 2012-2021 MATE developers"),
"documenters", documenters,
"logo-icon-name", FISH_ICON,
"translator-credits", _("translator-credits"),
"version", VERSION, /* "3.4.7.4ac19" */
- "website", "http://mate-desktop.org/",
+ "website", PACKAGE_URL,
NULL);
g_free(descr);
@@ -999,11 +999,12 @@ static void name_changed_notify(GSettings* settings, gchar* key, FishApplet* fis
value = g_settings_get_string (settings, key);
- if (!value [0] || (fish->name && !strcmp (fish->name, value)))
+ if (!value || *value == '\0' || (fish->name && !strcmp (fish->name, value))) {
+ g_free (value);
return;
+ }
- if (fish->name)
- g_free (fish->name);
+ g_free (fish->name);
fish->name = g_strdup (value);
update_fortune_dialog (fish);
@@ -1014,8 +1015,7 @@ static void name_changed_notify(GSettings* settings, gchar* key, FishApplet* fis
strcmp (gtk_entry_get_text (GTK_ENTRY (fish->name_entry)), fish->name))
gtk_entry_set_text (GTK_ENTRY (fish->name_entry), fish->name);
- if (value)
- g_free (value);
+ g_free (value);
}
static void image_changed_notify(GSettings* settings, gchar* key, FishApplet* fish)
@@ -1024,11 +1024,12 @@ static void image_changed_notify(GSettings* settings, gchar* key, FishApplet* fi
value = g_settings_get_string (settings, key);
- if (!value [0] || (fish->image && !strcmp (fish->image, value)))
+ if (!value || *value == '\0' || (fish->image && !strcmp (fish->image, value))) {
+ g_free (value);
return;
+ }
- if (fish->image)
- g_free (fish->image);
+ g_free (fish->image);
fish->image = g_strdup (value);
load_fish_image (fish);
@@ -1048,8 +1049,7 @@ static void image_changed_notify(GSettings* settings, gchar* key, FishApplet* fi
g_free (path_chooser);
}
- if (value)
- g_free (value);
+ g_free (value);
}
static void command_changed_notify(GSettings* settings, gchar* key, FishApplet* fish)
@@ -1058,19 +1058,19 @@ static void command_changed_notify(GSettings* settings, gchar* key, FishApplet*
value = g_settings_get_string (settings, key);
- if (fish->command && !strcmp (fish->command, value))
+ if (!value || *value == '\0' || (fish->command && !strcmp (fish->command, value))) {
+ g_free (value);
return;
+ }
- if (fish->command)
- g_free (fish->command);
+ g_free (fish->command);
fish->command = g_strdup (value);
if (fish->command_entry &&
strcmp (gtk_entry_get_text (GTK_ENTRY (fish->command_entry)), fish->command))
gtk_entry_set_text (GTK_ENTRY (fish->command_entry), fish->command);
- if (value)
- g_free (value);
+ g_free (value);
}
static void n_frames_changed_notify(GSettings* settings, gchar* key, FishApplet* fish)
@@ -1435,16 +1435,16 @@ static void update_pixmap(FishApplet* fish)
if (fish->april_fools) {
cairo_matrix_translate (&matrix,
pixbuf_width - 1, pixbuf_height - 1);
- cairo_matrix_rotate (&matrix, M_PI);
+ cairo_matrix_rotate (&matrix, G_PI);
}
if (rotate) {
if (fish->orientation == MATE_PANEL_APPLET_ORIENT_RIGHT) {
cairo_matrix_translate (&matrix, pixbuf_width - 1, 0);
- cairo_matrix_rotate (&matrix, M_PI * 0.5);
+ cairo_matrix_rotate (&matrix, G_PI_2);
} else {
cairo_matrix_translate (&matrix, 0, pixbuf_height - 1);
- cairo_matrix_rotate (&matrix, M_PI * 1.5);
+ cairo_matrix_rotate (&matrix, G_PI * 1.5);
}
cairo_matrix_scale (&matrix,
(double) (pixbuf_height - 1) / width,
@@ -1793,16 +1793,13 @@ static void fish_applet_dispose (GObject *object)
g_object_unref (fish->lockdown_settings);
fish->lockdown_settings = NULL;
- if (fish->name)
- g_free (fish->name);
+ g_free (fish->name);
fish->name = NULL;
- if (fish->image)
- g_free (fish->image);
+ g_free (fish->image);
fish->image = NULL;
- if (fish->command)
- g_free (fish->command);
+ g_free (fish->command);
fish->command = NULL;
if (fish->surface)
@@ -1882,8 +1879,6 @@ static void fish_applet_instance_init(FishApplet* fish, FishAppletClass* klass)
fish->april_fools = FALSE;
mate_panel_applet_set_flags (MATE_PANEL_APPLET (fish), MATE_PANEL_APPLET_EXPAND_MINOR);
-
- mate_panel_applet_set_background_widget(MATE_PANEL_APPLET(fish), GTK_WIDGET(fish));
}
static void fish_applet_class_init(FishAppletClass* klass)
diff --git a/applets/notification_area/main.c b/applets/notification_area/main.c
index 05962969..2f0dafdb 100644
--- a/applets/notification_area/main.c
+++ b/applets/notification_area/main.c
@@ -194,7 +194,7 @@ ensure_prefs_window_is_created (NaTrayApplet *applet)
gtk_spin_button_set_range (GTK_SPIN_BUTTON (applet->priv->dialog->min_icon_size_spin), 7, 130);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (applet->priv->dialog->min_icon_size_spin), applet->priv->min_icon_size);
- g_signal_connect_swapped (applet->priv->dialog->min_icon_size_spin, "value_changed",
+ g_signal_connect_swapped (applet->priv->dialog->min_icon_size_spin, "value-changed",
G_CALLBACK (na_preferences_dialog_min_icon_size_changed),
applet);
@@ -280,7 +280,7 @@ static void about_cb(GtkAction* action, NaTrayApplet* applet)
"copyright", _("Copyright \xc2\xa9 2002 Red Hat, Inc.\n"
"Copyright \xc2\xa9 2003-2006 Vincent Untz\n"
"Copyright \xc2\xa9 2011 Perberos\n"
- "Copyright \xc2\xa9 2012-2020 MATE developers"),
+ "Copyright \xc2\xa9 2012-2021 MATE developers"),
"documenters", documenters,
"logo-icon-name", NOTIFICATION_AREA_ICON,
"translator-credits", _("translator-credits"),
diff --git a/applets/notification_area/status-notifier/org.kde.StatusNotifierItem.xml b/applets/notification_area/status-notifier/org.kde.StatusNotifierItem.xml
index 609d3050..c7aa0ebd 100644
--- a/applets/notification_area/status-notifier/org.kde.StatusNotifierItem.xml
+++ b/applets/notification_area/status-notifier/org.kde.StatusNotifierItem.xml
@@ -69,12 +69,20 @@
<property name="IconThemePath" type="s" access="read" />
+ <property name="ItemIsMenu" type="b" access="read" />
+
<property name="Menu" type="o" access="read" />
- <property name="ItemIsMenu" type="b" access="read" />
+ <property name="XAyatanaLabel" type="s" access="read" />
<signal name="NewIconThemePath">
<arg name="icon_theme_path" type="s" />
</signal>
+
+ <signal name="XAyatanaNewLabel">
+ <arg name="label" type="s" />
+ <arg name="guide" type="s" />
+ </signal>
+
</interface>
</node>
diff --git a/applets/notification_area/status-notifier/sn-item-v0.c b/applets/notification_area/status-notifier/sn-item-v0.c
index d218abad..3ec4d037 100644
--- a/applets/notification_area/status-notifier/sn-item-v0.c
+++ b/applets/notification_area/status-notifier/sn-item-v0.c
@@ -59,6 +59,7 @@ struct _SnItemV0
gchar *title;
gint32 window_id;
gchar *icon_name;
+ gchar *label;
SnIconPixmap **icon_pixmap;
gchar *overlay_icon_name;
SnIconPixmap **overlay_icon_pixmap;
@@ -83,7 +84,7 @@ enum
LAST_PROP
};
-static GParamSpec *properties[LAST_PROP] = { NULL };
+static GParamSpec *obj_properties[LAST_PROP] = { NULL };
G_DEFINE_TYPE (SnItemV0, sn_item_v0, SN_TYPE_ITEM)
@@ -329,6 +330,7 @@ update (SnItemV0 *v0)
gtk_widget_set_tooltip_markup (GTK_WIDGET (v0), NULL);
}
+ gtk_button_set_label (GTK_BUTTON (v0), v0->label);
accessible = gtk_widget_get_accessible (GTK_WIDGET (v0));
if (v0->title != NULL && *v0->title != '\0')
@@ -848,6 +850,21 @@ new_status_cb (SnItemV0 *v0,
}
static void
+new_label_cb (SnItemV0 *v0,
+ GVariant *parameters)
+{
+ GVariant *variant;
+
+ variant = g_variant_get_child_value (parameters, 0);
+
+ g_free (v0->label);
+ v0->label = g_variant_dup_string (variant, NULL);
+ g_variant_unref (variant);
+
+ queue_update (v0);
+}
+
+static void
new_icon_theme_path_cb (SnItemV0 *v0,
GVariant *parameters)
{
@@ -905,6 +922,8 @@ g_signal_cb (GDBusProxy *proxy,
new_status_cb (v0, parameters);
else if (g_strcmp0 (signal_name, "NewIconThemePath") == 0)
new_icon_theme_path_cb (v0, parameters);
+ else if (g_strcmp0 (signal_name, "XAyatanaNewLabel") == 0)
+ new_label_cb (v0, parameters);
else
g_debug ("signal '%s' not handled!", signal_name);
}
@@ -975,6 +994,8 @@ get_all_cb (GObject *source_object,
v0->menu = g_variant_dup_string (value, NULL);
else if (g_strcmp0 (key, "ItemIsMenu") == 0)
v0->item_is_menu = g_variant_get_boolean (value);
+ else if (g_strcmp0 (key, "XAyatanaLabel") == 0)
+ v0->label = g_variant_dup_string (value, NULL);
else
g_debug ("property '%s' not handled!", key);
@@ -1111,6 +1132,7 @@ sn_item_v0_finalize (GObject *object)
g_clear_pointer (&v0->title, g_free);
g_clear_pointer (&v0->icon_name, g_free);
+ g_clear_pointer (&v0->label, g_free);
g_clear_pointer (&v0->icon_pixmap, icon_pixmap_free);
g_clear_pointer (&v0->overlay_icon_name, g_free);
g_clear_pointer (&v0->overlay_icon_pixmap, icon_pixmap_free);
@@ -1345,15 +1367,15 @@ sn_item_v0_set_property (GObject *object,
static void
install_properties (GObjectClass *object_class)
{
- properties[PROP_ICON_SIZE] =
+ obj_properties[PROP_ICON_SIZE] =
g_param_spec_int ("icon-size", "Icon size", "Icon size", 0, G_MAXINT, 16,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- properties[PROP_ICON_PADDING] =
+ obj_properties[PROP_ICON_PADDING] =
g_param_spec_int ("icon-padding", "Icon padding", "Icon padding", 0,
G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- g_object_class_install_properties (object_class, LAST_PROP, properties);
+ g_object_class_install_properties (object_class, LAST_PROP, obj_properties);
}
static void
@@ -1395,7 +1417,7 @@ sn_item_v0_init (SnItemV0 *v0)
v0->icon_size = 16;
v0->effective_icon_size = 0;
v0->image = gtk_image_new ();
- gtk_container_add (GTK_CONTAINER (v0), v0->image);
+ gtk_button_set_image (GTK_BUTTON (v0), v0->image);
gtk_widget_show (v0->image);
}
@@ -1465,7 +1487,7 @@ sn_item_v0_set_icon_size (SnItemV0 *v0,
if (v0->icon_size != size)
{
v0->icon_size = size;
- g_object_notify_by_pspec (G_OBJECT (v0), properties[PROP_ICON_SIZE]);
+ g_object_notify_by_pspec (G_OBJECT (v0), obj_properties[PROP_ICON_SIZE]);
if (v0->id != NULL)
queue_update (v0);
diff --git a/applets/wncklet/Makefile.am b/applets/wncklet/Makefile.am
index 38dfaca5..ed442671 100644
--- a/applets/wncklet/Makefile.am
+++ b/applets/wncklet/Makefile.am
@@ -1,3 +1,5 @@
+AUTOMAKE_OPTIONS = subdir-objects
+
AM_CPPFLAGS = \
$(LIBMATE_PANEL_APPLET_CFLAGS) \
$(WNCKLET_CFLAGS) \
diff --git a/applets/wncklet/showdesktop.c b/applets/wncklet/showdesktop.c
index c3454a0f..aabc1a63 100644
--- a/applets/wncklet/showdesktop.c
+++ b/applets/wncklet/showdesktop.c
@@ -22,7 +22,7 @@
*/
#ifdef HAVE_CONFIG_H
- #include <config.h>
+#include <config.h>
#endif
#include <glib/gi18n.h>
@@ -458,8 +458,6 @@ gboolean show_desktop_applet_fill(MatePanelApplet* applet)
initial oriantation, and we get that during the _add call */
g_signal_connect(G_OBJECT (sdd->applet), "change_orient", G_CALLBACK (applet_change_orient), sdd);
- mate_panel_applet_set_background_widget(MATE_PANEL_APPLET (sdd->applet), GTK_WIDGET(sdd->applet));
-
action_group = gtk_action_group_new("ShowDesktop Applet Actions");
gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions(action_group, show_desktop_menu_actions, G_N_ELEMENTS (show_desktop_menu_actions), sdd);
@@ -506,13 +504,13 @@ static void display_about_dialog(GtkAction* action, ShowDesktopData* sdd)
"comments", _("This button lets you hide all windows and show the desktop."),
"copyright", _("Copyright \xc2\xa9 2002 Red Hat, Inc.\n"
"Copyright \xc2\xa9 2011 Perberos\n"
- "Copyright \xc2\xa9 2012-2020 MATE developers"),
+ "Copyright \xc2\xa9 2012-2021 MATE developers"),
"documenters", documenters,
"icon-name", SHOW_DESKTOP_ICON,
"logo-icon-name", SHOW_DESKTOP_ICON,
"translator-credits", _("translator-credits"),
"version", VERSION,
- "website", "http://www.mate-desktop.org/",
+ "website", PACKAGE_URL,
NULL);
}
diff --git a/applets/wncklet/wayland-backend.c b/applets/wncklet/wayland-backend.c
index 658eb6d3..a6f50a77 100644
--- a/applets/wncklet/wayland-backend.c
+++ b/applets/wncklet/wayland-backend.c
@@ -55,7 +55,6 @@ static struct wl_registry *wl_registry_global = NULL;
static uint32_t foreign_toplevel_manager_global_id = 0;
static uint32_t foreign_toplevel_manager_global_version = 0;
-static TasklistManager *tasklist_manager_new ();
static ToplevelTask *toplevel_task_new (TasklistManager *tasklist, struct zwlr_foreign_toplevel_handle_v1 *handle);
static void
@@ -92,7 +91,7 @@ static const struct wl_registry_listener wl_registry_listener = {
};
static void
-wayland_tasklist_init_if_needed ()
+wayland_tasklist_init_if_needed (void)
{
if (has_initialized)
return;
@@ -165,7 +164,7 @@ tasklist_manager_disconnected_from_widget (TasklistManager *tasklist)
}
static TasklistManager *
-tasklist_manager_new ()
+tasklist_manager_new (void)
{
if (!foreign_toplevel_manager_global_id)
return NULL;
diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c
index dd18fc72..ce3ddbb4 100644
--- a/applets/wncklet/window-list.c
+++ b/applets/wncklet/window-list.c
@@ -73,6 +73,7 @@ typedef struct {
/* Properties: */
GtkWidget* properties_dialog;
+ GtkWidget* wayland_info_label;
GtkWidget* show_current_radio;
GtkWidget* show_all_radio;
#ifdef HAVE_WINDOW_PREVIEWS
@@ -119,10 +120,17 @@ static void tasklist_update(TasklistData* tasklist)
WnckTasklistGroupingType grouping;
switch (tasklist->grouping)
{
- case TASKLIST_NEVER_GROUP: grouping = WNCK_TASKLIST_NEVER_GROUP;
- case TASKLIST_AUTO_GROUP: grouping = WNCK_TASKLIST_AUTO_GROUP;
- case TASKLIST_ALWAYS_GROUP: grouping = WNCK_TASKLIST_ALWAYS_GROUP;
- default: grouping = WNCK_TASKLIST_NEVER_GROUP;
+ case TASKLIST_NEVER_GROUP:
+ grouping = WNCK_TASKLIST_NEVER_GROUP;
+ break;
+ case TASKLIST_AUTO_GROUP:
+ grouping = WNCK_TASKLIST_AUTO_GROUP;
+ break;
+ case TASKLIST_ALWAYS_GROUP:
+ grouping = WNCK_TASKLIST_ALWAYS_GROUP;
+ break;
+ default:
+ grouping = WNCK_TASKLIST_NEVER_GROUP;
}
wnck_tasklist_set_grouping(WNCK_TASKLIST(tasklist->tasklist), grouping);
wnck_tasklist_set_include_all_workspaces(WNCK_TASKLIST(tasklist->tasklist), tasklist->include_all_workspaces);
@@ -236,71 +244,87 @@ static void applet_change_background(MatePanelApplet* applet, MatePanelAppletBac
#ifdef HAVE_X11
#ifdef HAVE_WINDOW_PREVIEWS
-static GdkPixbuf *preview_window_thumbnail (WnckWindow *wnck_window, TasklistData *tasklist)
+static cairo_surface_t*
+preview_window_thumbnail (WnckWindow *wnck_window,
+ TasklistData *tasklist,
+ int *thumbnail_width,
+ int *thumbnail_height,
+ int *thumbnail_scale)
{
GdkWindow *window;
- GdkPixbuf *screenshot;
- GdkPixbuf *thumbnail;
+ GdkWindow *window_wrapper = NULL;
+ Window win;
+ cairo_surface_t *thumbnail;
+ cairo_t *cr;
double ratio;
- int width, height;
- int scale;
+ int width, height, scale;
- window = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), wnck_window_get_xid (wnck_window));
+ win = wnck_window_get_xid (wnck_window);
- if (window == NULL)
- return NULL;
+ if ((window = gdk_x11_window_lookup_for_display (gdk_display_get_default (), win)) == NULL)
+ {
+ if ((window = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), win)) == NULL)
+ {
+ return NULL;
+ }
+ else
+ {
+ window_wrapper = window;
+ }
+ }
+ else
+ {
+ g_object_ref (window);
+ }
- scale = gdk_window_get_scale_factor (window);
+ *thumbnail_scale = scale = gdk_window_get_scale_factor (window);
width = gdk_window_get_width (window) * scale;
height = gdk_window_get_height (window) * scale;
- /* Generate window screenshot for preview */
- screenshot = gdk_pixbuf_get_from_window (window, 0, 0, width / scale, height / scale);
- g_object_unref (window);
-
- if (screenshot == NULL)
- return NULL;
-
- /* Determine whether the contents of the screenshot are empty */
- if (gdk_pixbuf_get_byte_length (screenshot) == 0)
- {
- g_object_unref (screenshot);
- return NULL;
- }
-
/* Scale to configured size while maintaining aspect ratio */
if (width > height)
{
- ratio = (double) height / (double) width;
- width = MIN(width, tasklist->thumbnail_size);
- height = width * ratio;
+ int max_size = MIN (width, tasklist->thumbnail_size * scale);
+ ratio = (double) max_size / (double) width;
+ *thumbnail_width = max_size;
+ *thumbnail_height = (int) ((double) height * ratio);
}
else
{
- ratio = (double) width / (double) height;
- height = MIN(height, tasklist->thumbnail_size);
- width = height * ratio;
+ int max_size = MIN (height, tasklist->thumbnail_size * scale);
+ ratio = (double) max_size / (double) height;
+ *thumbnail_height = max_size;
+ *thumbnail_width = (int) ((double) width * ratio);
}
- thumbnail = gdk_pixbuf_scale_simple (screenshot, width, height, GDK_INTERP_BILINEAR);
- g_object_unref (screenshot);
+ thumbnail = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+ *thumbnail_width,
+ *thumbnail_height);
+ cairo_surface_set_device_scale (thumbnail, scale, scale);
+ cr = cairo_create (thumbnail);
+ cairo_scale (cr, ratio, ratio);
+ gdk_cairo_set_source_window (cr, window, 0, 0);
+ cairo_paint (cr);
+ cairo_destroy (cr);
+
+ if (window_wrapper)
+ g_object_unref (window_wrapper);
+ g_object_unref (window);
return thumbnail;
}
#define PREVIEW_PADDING 5
-static void preview_window_reposition (TasklistData *tasklist, GdkPixbuf *thumbnail)
+static void
+preview_window_reposition (TasklistData *tasklist,
+ cairo_surface_t *thumbnail,
+ int width,
+ int height,
+ int scale)
{
GdkMonitor *monitor;
GdkRectangle monitor_geom;
int x_pos, y_pos;
- int width, height;
-
- width = gdk_pixbuf_get_width (thumbnail);
- height = gdk_pixbuf_get_height (thumbnail);
-
- /* Resize window to fit thumbnail */
- gtk_window_resize (GTK_WINDOW (tasklist->preview), width, height);
/* Set position at pointer, then re-adjust from there to just outside of the pointer */
gtk_window_set_position (GTK_WINDOW (tasklist->preview), GTK_WIN_POS_MOUSE);
@@ -314,13 +338,13 @@ static void preview_window_reposition (TasklistData *tasklist, GdkPixbuf *thumbn
switch (mate_panel_applet_get_orient (MATE_PANEL_APPLET (tasklist->applet)))
{
case MATE_PANEL_APPLET_ORIENT_LEFT:
- x_pos = monitor_geom.width + monitor_geom.x - (width + tasklist->size) - PREVIEW_PADDING;
+ x_pos = monitor_geom.width + monitor_geom.x - (width/scale + tasklist->size) - PREVIEW_PADDING;
break;
case MATE_PANEL_APPLET_ORIENT_RIGHT:
x_pos = tasklist->size + PREVIEW_PADDING;
break;
case MATE_PANEL_APPLET_ORIENT_UP:
- y_pos = monitor_geom.height + monitor_geom.y - (height + tasklist->size) - PREVIEW_PADDING;
+ y_pos = monitor_geom.height + monitor_geom.y - (height/scale + tasklist->size) - PREVIEW_PADDING;
break;
case MATE_PANEL_APPLET_ORIENT_DOWN:
default:
@@ -331,21 +355,24 @@ static void preview_window_reposition (TasklistData *tasklist, GdkPixbuf *thumbn
gtk_window_move (GTK_WINDOW (tasklist->preview), x_pos, y_pos);
}
-static gboolean preview_window_draw (GtkWidget *widget, cairo_t *cr, GdkPixbuf *thumbnail)
+static gboolean preview_window_draw (GtkWidget *widget, cairo_t *cr, cairo_surface_t *thumbnail)
{
GtkStyleContext *context;
context = gtk_widget_get_style_context (widget);
- gtk_render_icon (context, cr, thumbnail, 0, 0);
+ gtk_render_icon_surface (context, cr, thumbnail, 0, 0);
return FALSE;
}
static gboolean applet_enter_notify_event (WnckTasklist *tl, GList *wnck_windows, TasklistData *tasklist)
{
- GdkPixbuf *thumbnail;
+ cairo_surface_t *thumbnail;
WnckWindow *wnck_window = NULL;
int n_windows;
+ int thumbnail_width;
+ int thumbnail_height;
+ int thumbnail_scale;
if (tasklist->preview != NULL)
{
@@ -373,7 +400,7 @@ static gboolean applet_enter_notify_event (WnckTasklist *tl, GList *wnck_windows
wnck_screen_get_active_workspace (wnck_screen_get_default ())))
return FALSE;
- thumbnail = preview_window_thumbnail (wnck_window, tasklist);
+ thumbnail = preview_window_thumbnail (wnck_window, tasklist, &thumbnail_width, &thumbnail_height, &thumbnail_scale);
if (thumbnail == NULL)
return FALSE;
@@ -382,13 +409,14 @@ static gboolean applet_enter_notify_event (WnckTasklist *tl, GList *wnck_windows
tasklist->preview = gtk_window_new (GTK_WINDOW_POPUP);
gtk_widget_set_app_paintable (tasklist->preview, TRUE);
+ gtk_window_set_default_size (GTK_WINDOW (tasklist->preview), thumbnail_width/thumbnail_scale, thumbnail_height/thumbnail_scale);
gtk_window_set_resizable (GTK_WINDOW (tasklist->preview), TRUE);
- preview_window_reposition (tasklist, thumbnail);
+ preview_window_reposition (tasklist, thumbnail, thumbnail_width, thumbnail_height, thumbnail_scale);
gtk_widget_show (tasklist->preview);
- g_signal_connect_data (G_OBJECT (tasklist->preview), "draw", G_CALLBACK (preview_window_draw), thumbnail, (GClosureNotify) G_CALLBACK (g_object_unref), 0);
+ g_signal_connect_data (G_OBJECT (tasklist->preview), "draw", G_CALLBACK (preview_window_draw), thumbnail, (GClosureNotify) G_CALLBACK (cairo_surface_destroy), 0);
return FALSE;
}
@@ -787,8 +815,6 @@ gboolean window_list_applet_fill(MatePanelApplet* applet)
g_signal_connect(G_OBJECT(tasklist->applet), "change_size", G_CALLBACK(applet_change_pixel_size), tasklist);
g_signal_connect(G_OBJECT(tasklist->applet), "change_background", G_CALLBACK(applet_change_background), tasklist);
- mate_panel_applet_set_background_widget(MATE_PANEL_APPLET(tasklist->applet), GTK_WIDGET(tasklist->applet));
-
action_group = gtk_action_group_new("Tasklist Applet Actions");
gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions(action_group, tasklist_menu_actions, G_N_ELEMENTS(tasklist_menu_actions), tasklist);
@@ -889,13 +915,13 @@ static void display_about_dialog(GtkAction* action, TasklistData* tasklist)
"comments", _("The Window List shows a list of all windows in a set of buttons and lets you browse them."),
"copyright", _("Copyright \xc2\xa9 2002 Red Hat, Inc.\n"
"Copyright \xc2\xa9 2011 Perberos\n"
- "Copyright \xc2\xa9 2012-2020 MATE developers"),
+ "Copyright \xc2\xa9 2012-2021 MATE developers"),
"documenters", documenters,
"icon-name", WINDOW_LIST_ICON,
"logo-icon-name", WINDOW_LIST_ICON,
"translator-credits", _("translator-credits"),
"version", VERSION,
- "website", "http://www.mate-desktop.org/",
+ "website", PACKAGE_URL,
NULL);
}
@@ -959,6 +985,8 @@ static void setup_sensitivity(TasklistData* tasklist, GtkBuilder* builder, const
#ifdef HAVE_WAYLAND
static void setup_dialog_wayland(TasklistData* tasklist)
{
+ gtk_widget_show(tasklist->wayland_info_label);
+
gtk_widget_set_sensitive(tasklist->window_list_content_box, FALSE);
gtk_widget_set_sensitive(tasklist->window_grouping_box, FALSE);
gtk_widget_set_sensitive(tasklist->minimized_windows_box, FALSE);
@@ -976,6 +1004,7 @@ static void setup_dialog(GtkBuilder* builder, TasklistData* tasklist)
GtkAdjustment *adjustment;
#endif /* HAVE_WINDOW_PREVIEWS */
+ tasklist->wayland_info_label = WID("wayland_info_label");
tasklist->show_current_radio = WID("show_current_radio");
tasklist->show_all_radio = WID("show_all_radio");
diff --git a/applets/wncklet/window-list.ui b/applets/wncklet/window-list.ui
index 2161d427..765b5b68 100644
--- a/applets/wncklet/window-list.ui
+++ b/applets/wncklet/window-list.ui
@@ -77,6 +77,22 @@
<property name="orientation">vertical</property>
<property name="spacing">18</property>
<child>
+ <object class="GtkLabel" id="wayland_info_label">
+ <property name="visible">False</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Some options not available on Wayland</property>
+ <property name="xalign">0</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkBox" id="window_list_content_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -154,7 +170,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -270,7 +286,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
diff --git a/applets/wncklet/window-menu.c b/applets/wncklet/window-menu.c
index 48b1c31b..804898d8 100644
--- a/applets/wncklet/window-menu.c
+++ b/applets/wncklet/window-menu.c
@@ -26,7 +26,7 @@
*/
#ifdef HAVE_CONFIG_H
- #include <config.h>
+#include <config.h>
#endif
#include <string.h>
@@ -88,13 +88,13 @@ static void window_menu_about(GtkAction* action, WindowMenu* window_menu)
"Copyright \xc2\xa9 2001 Free Software Foundation, Inc.\n"
"Copyright \xc2\xa9 2003 Sun Microsystems, Inc.\n"
"Copyright \xc2\xa9 2011 Perberos\n"
- "Copyright \xc2\xa9 2012-2020 MATE developers"),
+ "Copyright \xc2\xa9 2012-2021 MATE developers"),
"documenters", documenters,
"icon-name", WINDOW_MENU_ICON,
"logo-icon-name", WINDOW_MENU_ICON,
"translator-credits", _("translator-credits"),
"version", VERSION,
- "website", "http://www.mate-desktop.org/",
+ "website", PACKAGE_URL,
NULL);
}
@@ -253,8 +253,6 @@ gboolean window_menu_applet_fill(MatePanelApplet* applet)
if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
{
window_menu->selector = wnck_selector_new();
- mate_panel_applet_set_background_widget(MATE_PANEL_APPLET(window_menu->applet), GTK_WIDGET(window_menu->selector));
-
}
else
#endif /* HAVE_X11 */
diff --git a/applets/wncklet/workspace-switcher.c b/applets/wncklet/workspace-switcher.c
index 2335bb1d..22b473bd 100644
--- a/applets/wncklet/workspace-switcher.c
+++ b/applets/wncklet/workspace-switcher.c
@@ -200,14 +200,13 @@ static void update_properties_for_wm(PagerData* pager)
static void window_manager_changed(WnckScreen* screen, PagerData* pager)
{
+#ifdef HAVE_X11
const char *wm_name = NULL;
-#ifdef HAVE_X11
if (pager->screen)
{
wm_name = wnck_screen_get_window_manager_name (pager->screen);
}
-#endif /* HAVE_X11 */
if (!wm_name)
pager->wm = PAGER_WM_UNKNOWN;
@@ -221,6 +220,9 @@ static void window_manager_changed(WnckScreen* screen, PagerData* pager)
pager->wm = PAGER_WM_COMPIZ;
else
pager->wm = PAGER_WM_UNKNOWN;
+#else
+ pager->wm = PAGER_WM_UNKNOWN;
+#endif /* HAVE_X11 */
update_properties_for_wm(pager);
pager_update(pager);
@@ -321,11 +323,13 @@ static void applet_style_updated (MatePanelApplet *applet, GtkStyleContext *cont
*/
static gboolean applet_scroll(MatePanelApplet* applet, GdkEventScroll* event, PagerData* pager)
{
+#ifdef HAVE_X11
GdkScrollDirection absolute_direction;
int index;
int n_workspaces;
int n_columns;
int in_last_row;
+#endif /* HAVE_X11 */
if (event->type != GDK_SCROLL)
return FALSE;
@@ -340,7 +344,6 @@ static gboolean applet_scroll(MatePanelApplet* applet, GdkEventScroll* event, Pa
n_workspaces = wnck_screen_get_workspace_count(pager->screen);
}
else
-#endif /* HAVE_X11 */
{
index = 0;
n_workspaces = 1;
@@ -431,7 +434,6 @@ static gboolean applet_scroll(MatePanelApplet* applet, GdkEventScroll* event, Pa
break;
}
-#ifdef HAVE_X11
if (pager->screen)
{
wnck_workspace_activate(wnck_screen_get_workspace(pager->screen, index), event->time);
@@ -646,8 +648,6 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet)
gtk_widget_show(pager->pager);
gtk_widget_show(pager->applet);
- mate_panel_applet_set_background_widget(MATE_PANEL_APPLET(pager->applet), GTK_WIDGET(pager->applet));
-
action_group = gtk_action_group_new("WorkspaceSwitcher Applet Actions");
gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions(action_group, pager_menu_actions, G_N_ELEMENTS(pager_menu_actions), pager);
@@ -697,13 +697,13 @@ static void display_about_dialog(GtkAction* action, PagerData* pager)
"comments", _("The Workspace Switcher shows you a small version of your workspaces that lets you manage your windows."),
"copyright", _("Copyright \xc2\xa9 2002 Red Hat, Inc.\n"
"Copyright \xc2\xa9 2011 Perberos\n"
- "Copyright \xc2\xa9 2012-2020 MATE developers"),
+ "Copyright \xc2\xa9 2012-2021 MATE developers"),
"documenters", documenters,
"icon-name", WORKSPACE_SWITCHER_ICON,
"logo-icon-name", WORKSPACE_SWITCHER_ICON,
"translator-credits", _("translator-credits"),
"version", VERSION,
- "website", "http://www.mate-desktop.org/",
+ "website", PACKAGE_URL,
NULL);
}
@@ -796,12 +796,14 @@ static void workspace_destroyed(WnckScreen* screen, WnckWorkspace* space, PagerD
}
#endif /* HAVE_X11 */
-static void num_workspaces_value_changed(GtkSpinButton* button, PagerData* pager)
+static void
+on_num_workspaces_value_changed (GtkSpinButton *button,
+ PagerData *pager)
{
#ifdef HAVE_X11
if (pager->screen)
{
- int workspace_count = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(pager->num_workspaces_spin));
+ int workspace_count = gtk_spin_button_get_value_as_int (button);
wnck_screen_change_workspace_count(pager->screen, workspace_count);
}
#endif /* HAVE_X11 */
@@ -1015,7 +1017,7 @@ static void setup_dialog(GtkBuilder* builder, PagerData* pager)
}
/* Num rows: */
- g_signal_connect(G_OBJECT(pager->num_rows_spin), "value_changed", (GCallback) num_rows_value_changed, pager);
+ g_signal_connect (pager->num_rows_spin, "value-changed", G_CALLBACK (num_rows_value_changed), pager);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(pager->num_rows_spin), pager->n_rows);
gtk_label_set_text(GTK_LABEL(pager->label_row_col), pager->orientation == GTK_ORIENTATION_HORIZONTAL ? _("rows") : _("columns"));
@@ -1043,7 +1045,7 @@ static void setup_dialog(GtkBuilder* builder, PagerData* pager)
}
#endif /* HAVE_X11 */
- g_signal_connect(G_OBJECT(pager->num_workspaces_spin), "value_changed", (GCallback) num_workspaces_value_changed, pager);
+ g_signal_connect (pager->num_workspaces_spin, "value-changed", G_CALLBACK (on_num_workspaces_value_changed), pager);
g_signal_connect(G_OBJECT(pager->workspaces_tree), "focus_out_event", (GCallback) workspaces_tree_focused_out, pager);