summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormbkma <[email protected]>2026-03-14 11:19:25 +0100
committermbkma <[email protected]>2026-03-14 11:19:25 +0100
commit891730e652b1d265e7739cc527c757c5b31f4429 (patch)
treed12a5d66b711577739118ad52b93cf1ae5316385
parent37fd0c5169e37b2962c9979659d693eec1d0bf24 (diff)
downloadmate-panel-preview.tar.bz2
mate-panel-preview.tar.xz
use libwnck-4.0 to be able to disable tooltipspreview
-rw-r--r--applets/wncklet/org.mate.panel.applet.window-list-previews.gschema.xml.in13
-rw-r--r--applets/wncklet/window-list.c71
-rw-r--r--applets/wncklet/window-list.ui39
-rw-r--r--configure.ac4
4 files changed, 95 insertions, 32 deletions
diff --git a/applets/wncklet/org.mate.panel.applet.window-list-previews.gschema.xml.in b/applets/wncklet/org.mate.panel.applet.window-list-previews.gschema.xml.in
index 8f37281a..c47c1d69 100644
--- a/applets/wncklet/org.mate.panel.applet.window-list-previews.gschema.xml.in
+++ b/applets/wncklet/org.mate.panel.applet.window-list-previews.gschema.xml.in
@@ -1,9 +1,14 @@
<schemalist gettext-domain="@GETTEXT_PACKAGE@">
+ <enum id="org.mate.panel.applet.window-list-previews.PreviewType">
+ <value nick="none" value="0"/>
+ <value nick="tooltips" value="1"/>
+ <value nick="thumbnails" value="2"/>
+ </enum>
<schema id="org.mate.panel.applet.window-list-previews">
- <key name="show-window-thumbnails" type="b">
- <default>true</default>
- <summary>Display window thumbnails on hover</summary>
- <description>If true, then when hovering over a taskbar item, a thumbnail of the window will appear. It will go away as soon as the mouse leaves the item.</description>
+ <key name="window-preview-type" enum="org.mate.panel.applet.window-list-previews.PreviewType">
+ <default>'thumbnails'</default>
+ <summary>Window preview type on hover</summary>
+ <description>Controls what is shown when hovering over a taskbar item. "thumbnails" shows a window thumbnail, "tooltips" shows libwnck's built-in tooltip, "none" disables both.</description>
</key>
<key name="thumbnail-window-size" type="i">
<default>200</default>
diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c
index 17821cdd..3d4fbf98 100644
--- a/applets/wncklet/window-list.c
+++ b/applets/wncklet/window-list.c
@@ -52,6 +52,12 @@ typedef enum {
TASKLIST_ALWAYS_GROUP
} TasklistGroupingType;
+typedef enum {
+ PREVIEW_NONE,
+ PREVIEW_TOOLTIPS,
+ PREVIEW_THUMBNAILS
+} TasklistPreviewType;
+
typedef struct {
GtkWidget* applet;
GtkWidget* tasklist;
@@ -61,7 +67,7 @@ typedef struct {
WnckHandle* wnck_handle;
#endif
- gboolean show_window_thumbnails;
+ TasklistPreviewType preview_type;
gint thumbnail_size;
gboolean include_all_workspaces;
@@ -82,7 +88,7 @@ typedef struct {
GtkWidget* show_current_radio;
GtkWidget* show_all_radio;
GtkWidget* window_thumbnail_box;
- GtkWidget* show_thumbnails_check;
+ GtkWidget* preview_type_combo;
GtkWidget* thumbnail_size_label;
GtkWidget* thumbnail_size_spin;
GtkWidget* never_group_radio;
@@ -98,6 +104,8 @@ typedef struct {
GSettings* settings;
GSettings* preview_settings;
+
+ int size_hints[2]; /* fallback when wnck_tasklist_get_size_hint_list is unavailable */
} TasklistData;
static void call_system_monitor(GtkAction* action, TasklistData* tasklist);
@@ -140,6 +148,10 @@ static void tasklist_update(TasklistData* tasklist)
wnck_tasklist_set_switch_workspace_on_unminimize(WNCK_TASKLIST(tasklist->tasklist), tasklist->move_unminimized_windows);
wnck_tasklist_set_scroll_enabled (WNCK_TASKLIST(tasklist->tasklist), tasklist->scroll_enable);
wnck_tasklist_set_middle_click_close (WNCK_TASKLIST (tasklist->tasklist), tasklist->middle_click_close);
+#if WNCK_CHECK_VERSION(43, 1, 0)
+ wnck_tasklist_set_tooltips_enabled (WNCK_TASKLIST (tasklist->tasklist),
+ tasklist->preview_type == PREVIEW_TOOLTIPS);
+#endif
}
#endif /* HAVE_X11 */
@@ -180,7 +192,19 @@ static const int* tasklist_get_size_hint_list(TasklistData* tasklist, int* n_ele
#ifdef HAVE_X11
if (WNCK_IS_TASKLIST(tasklist->tasklist))
{
+#if !WNCK_CHECK_VERSION(43, 1, 0)
return wnck_tasklist_get_size_hint_list(WNCK_TASKLIST(tasklist->tasklist), n_elements);
+#else
+ int minimum, natural;
+ if (tasklist->orientation == GTK_ORIENTATION_HORIZONTAL)
+ gtk_widget_get_preferred_width(tasklist->tasklist, &minimum, &natural);
+ else
+ gtk_widget_get_preferred_height(tasklist->tasklist, &minimum, &natural);
+ tasklist->size_hints[0] = natural;
+ tasklist->size_hints[1] = minimum;
+ *n_elements = 2;
+ return tasklist->size_hints;
+#endif
}
else
#endif /* HAVE_X11 */
@@ -456,7 +480,7 @@ static gboolean applet_enter_notify_event (WnckTasklist *tl, GList *wnck_windows
tasklist->preview = NULL;
}
- if (!tasklist->show_window_thumbnails || wnck_windows == NULL)
+ if (tasklist->preview_type != PREVIEW_THUMBNAILS || wnck_windows == NULL)
return FALSE;
n_windows = g_list_length (wnck_windows);
@@ -609,9 +633,10 @@ static void tasklist_update_thumbnail_size_spin(TasklistData* tasklist)
gtk_spin_button_set_value(GTK_SPIN_BUTTON(button), (gdouble)tasklist->thumbnail_size);
}
-static void show_thumbnails_changed(GSettings* settings, gchar* key, TasklistData* tasklist)
+static void preview_type_changed(GSettings* settings, gchar* key, TasklistData* tasklist)
{
- tasklist->show_window_thumbnails = g_settings_get_boolean (settings, key);
+ tasklist->preview_type = g_settings_get_enum (settings, key);
+ tasklist_update (tasklist);
}
static void thumbnail_size_changed(GSettings *settings, gchar* key, TasklistData* tasklist)
@@ -711,8 +736,8 @@ static void setup_gsettings(TasklistData* tasklist)
tasklist->preview_settings = mate_panel_applet_settings_new (MATE_PANEL_APPLET (tasklist->applet), WINDOW_LIST_PREVIEW_SCHEMA);
g_signal_connect (tasklist->preview_settings,
- "changed::show-window-thumbnails",
- G_CALLBACK (show_thumbnails_changed),
+ "changed::window-preview-type",
+ G_CALLBACK (preview_type_changed),
tasklist);
g_signal_connect (tasklist->preview_settings,
@@ -797,7 +822,7 @@ gboolean window_list_applet_fill(MatePanelApplet* applet)
tasklist->include_all_workspaces = g_settings_get_boolean (tasklist->settings, "display-all-workspaces");
- tasklist->show_window_thumbnails = g_settings_get_boolean (tasklist->preview_settings, "show-window-thumbnails");
+ tasklist->preview_type = g_settings_get_enum (tasklist->preview_settings, "window-preview-type");
tasklist->thumbnail_size = g_settings_get_int (tasklist->preview_settings, "thumbnail-window-size");
@@ -994,6 +1019,18 @@ static void group_windows_toggled(GtkToggleButton* button, TasklistData* tasklis
}
}
+static void preview_type_combo_changed(GtkComboBox* combo, TasklistData* tasklist)
+{
+ gint active = gtk_combo_box_get_active (combo);
+
+ if (active < 0)
+ return;
+
+ g_settings_set_enum (tasklist->preview_settings, "window-preview-type", active);
+ gtk_widget_set_sensitive (tasklist->thumbnail_size_label, active == PREVIEW_THUMBNAILS);
+ gtk_widget_set_sensitive (tasklist->thumbnail_size_spin, active == PREVIEW_THUMBNAILS);
+}
+
static void thumbnail_size_spin_changed(GtkSpinButton* button, TasklistData* tasklist)
{
g_settings_set_int(tasklist->preview_settings, "thumbnail-window-size", gtk_spin_button_get_value_as_int(button));
@@ -1069,20 +1106,16 @@ static void setup_dialog(GtkBuilder* builder, TasklistData* tasklist)
setup_sensitivity(tasklist, builder, "never_group_radio", "auto_group_radio", "always_group_radio", "group-windows" /* key */);
tasklist->window_thumbnail_box = WID("window_thumbnail_box");
- tasklist->show_thumbnails_check = WID("show_thumbnails_check");
+ tasklist->preview_type_combo = WID("preview_type_combo");
tasklist->thumbnail_size_label = WID("thumbnail_size_label");
tasklist->thumbnail_size_spin = WID("thumbnail_size_spin");
- g_settings_bind(tasklist->preview_settings, "show-window-thumbnails", tasklist->show_thumbnails_check, "active", G_SETTINGS_BIND_DEFAULT);
- if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(tasklist->show_thumbnails_check))) {
- gtk_widget_set_sensitive (tasklist->thumbnail_size_label, TRUE);
- gtk_widget_set_sensitive (tasklist->thumbnail_size_spin, TRUE);
- } else {
- gtk_widget_set_sensitive (tasklist->thumbnail_size_label, FALSE);
- gtk_widget_set_sensitive (tasklist->thumbnail_size_spin, FALSE);
- }
- g_object_bind_property(tasklist->show_thumbnails_check, "active", tasklist->thumbnail_size_label, "sensitive", G_BINDING_DEFAULT);
- g_object_bind_property(tasklist->show_thumbnails_check, "active", tasklist->thumbnail_size_spin, "sensitive", G_BINDING_DEFAULT);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (tasklist->preview_type_combo), tasklist->preview_type);
+ gtk_widget_set_sensitive (tasklist->thumbnail_size_label, tasklist->preview_type == PREVIEW_THUMBNAILS);
+ gtk_widget_set_sensitive (tasklist->thumbnail_size_spin, tasklist->preview_type == PREVIEW_THUMBNAILS);
+ g_signal_connect (tasklist->preview_type_combo, "changed",
+ G_CALLBACK (preview_type_combo_changed),
+ tasklist);
tasklist->move_minimized_radio = WID("move_minimized_radio");
tasklist->change_workspace_radio = WID("change_workspace_radio");
diff --git a/applets/wncklet/window-list.ui b/applets/wncklet/window-list.ui
index 2ed06c0e..6b644aae 100644
--- a/applets/wncklet/window-list.ui
+++ b/applets/wncklet/window-list.ui
@@ -95,7 +95,7 @@
<object class="GtkLabel" id="thumbnails_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="label" translatable="yes">Window Thumbnails</property>
+ <property name="label" translatable="yes">Window Preview</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
@@ -115,13 +115,38 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
- <object class="GtkCheckButton" id="show_thumbnails_check">
- <property name="label" translatable="yes">Show _thumbnails on hover</property>
+ <object class="GtkBox" id="preview_type_box">
<property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">False</property>
- <property name="use-underline">True</property>
- <property name="draw-indicator">True</property>
+ <property name="can-focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="preview_type_label">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes">On hover:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="preview_type_combo">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <items>
+ <item translatable="yes">None</item>
+ <item translatable="yes">Tooltips</item>
+ <item translatable="yes">Thumbnails</item>
+ </items>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/configure.ac b/configure.ac
index 92dd8aae..c3d8fcec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,7 +61,7 @@ LIBMATE_MENU_REQUIRED=1.21.0
CAIRO_REQUIRED=1.0.0
DCONF_REQUIRED=0.13.4
GTK_REQUIRED=3.24.0
-LIBWNCK_REQUIRED=43.0
+LIBWNCK_REQUIRED=43.1
WEATHER_REQUIRED=1.17.0
dnl pkg-config dependency checks
@@ -87,7 +87,7 @@ PKG_CHECK_MODULES(NOTIFICATION_AREA, gtk+-3.0 >= $GTK_REQUIRED mate-desktop-2.0
AC_SUBST(NOTIFICATION_AREA_CFLAGS)
AC_SUBST(NOTIFICATION_AREA_LIBS)
-PKG_CHECK_MODULES(WNCKLET, gtk+-3.0 >= $GTK_REQUIRED libwnck-3.0 >= $LIBWNCK_REQUIRED mate-desktop-2.0 >= $LIBMATE_DESKTOP_REQUIRED)
+PKG_CHECK_MODULES(WNCKLET, gtk+-3.0 >= $GTK_REQUIRED libwnck-4.0 >= $LIBWNCK_REQUIRED mate-desktop-2.0 >= $LIBMATE_DESKTOP_REQUIRED)
AC_SUBST(WNCKLET_CFLAGS)
AC_SUBST(WNCKLET_LIBS)