diff options
author | zhuyaliang <[email protected]> | 2021-04-01 10:06:48 +0800 |
---|---|---|
committer | raveit65 <[email protected]> | 2021-04-05 14:02:29 +0200 |
commit | 8245b0e9dadb7c8be534301bf0060227199e79d6 (patch) | |
tree | 951c7992ff4f44624ed149baeb36ff8a6839f7cd /applets | |
parent | e9d2e89f5b66574401376c6ef64c856a6cee7f44 (diff) | |
download | mate-panel-8245b0e9dadb7c8be534301bf0060227199e79d6.tar.bz2 mate-panel-8245b0e9dadb7c8be534301bf0060227199e79d6.tar.xz |
Add window list disable mouse scrolling function
Diffstat (limited to 'applets')
-rw-r--r-- | applets/wncklet/org.mate.panel.applet.window-list.gschema.xml.in | 5 | ||||
-rw-r--r-- | applets/wncklet/window-list.c | 23 | ||||
-rw-r--r-- | applets/wncklet/window-list.ui | 65 |
3 files changed, 93 insertions, 0 deletions
diff --git a/applets/wncklet/org.mate.panel.applet.window-list.gschema.xml.in b/applets/wncklet/org.mate.panel.applet.window-list.gschema.xml.in index 0f2d871d..a02301f5 100644 --- a/applets/wncklet/org.mate.panel.applet.window-list.gschema.xml.in +++ b/applets/wncklet/org.mate.panel.applet.window-list.gschema.xml.in @@ -20,5 +20,10 @@ <summary>Move windows to current workspace when unminimized</summary> <description>If true, then when unminimizing a window, move it to the current workspace. Otherwise, switch to the workspace of the window.</description> </key> + <key name="scroll-enabled" type="b"> + <default>true</default> + <summary>Whether to enable mouse scrolling in the switch window list</summary> + <description>If true, enable mouse scrolling in window list, otherwise disable mouse scrolling in window list.</description> + </key> </schema> </schemalist> diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c index ce3ddbb4..28ebd170 100644 --- a/applets/wncklet/window-list.c +++ b/applets/wncklet/window-list.c @@ -62,6 +62,7 @@ typedef struct { TasklistGroupingType grouping; gboolean move_unminimized_windows; + gboolean scroll_enable; GtkOrientation orientation; int size; @@ -86,6 +87,7 @@ typedef struct { GtkWidget* auto_group_radio; GtkWidget* always_group_radio; GtkWidget* move_minimized_radio; + GtkWidget* mouse_scroll_check; GtkWidget* change_workspace_radio; GtkWidget* minimized_windows_box; GtkWidget* window_grouping_box; @@ -135,6 +137,7 @@ static void tasklist_update(TasklistData* tasklist) wnck_tasklist_set_grouping(WNCK_TASKLIST(tasklist->tasklist), grouping); wnck_tasklist_set_include_all_workspaces(WNCK_TASKLIST(tasklist->tasklist), tasklist->include_all_workspaces); 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); } #endif /* HAVE_X11 */ @@ -608,6 +611,12 @@ static void move_unminimized_windows_changed(GSettings* settings, gchar* key, Ta tasklist_update_unminimization_radio(tasklist); } +static void scroll_enabled_changed (GSettings* settings, gchar* key, TasklistData* tasklist) +{ + tasklist->scroll_enable = g_settings_get_boolean (settings, key); + tasklist_update(tasklist); +} + static void setup_gsettings(TasklistData* tasklist) { tasklist->settings = mate_panel_applet_settings_new (MATE_PANEL_APPLET (tasklist->applet), WINDOW_LIST_SCHEMA); @@ -633,6 +642,10 @@ static void setup_gsettings(TasklistData* tasklist) "changed::move-unminimized-windows", G_CALLBACK (move_unminimized_windows_changed), tasklist); + g_signal_connect (tasklist->settings, + "changed::scroll-enabled", + G_CALLBACK (scroll_enabled_changed), + tasklist); } static void applet_size_allocate(GtkWidget *widget, GtkAllocation *allocation, TasklistData *tasklist) @@ -756,6 +769,8 @@ gboolean window_list_applet_fill(MatePanelApplet* applet) tasklist->move_unminimized_windows = g_settings_get_boolean (tasklist->settings, "move-unminimized-windows"); + tasklist->scroll_enable = g_settings_get_boolean (tasklist->settings, "scroll-enabled"); + tasklist->size = mate_panel_applet_get_size(applet); #if !defined(WNCKLET_INPROCESS) && !GTK_CHECK_VERSION (3, 23, 0) @@ -1043,6 +1058,7 @@ static void setup_dialog(GtkBuilder* builder, TasklistData* tasklist) tasklist->move_minimized_radio = WID("move_minimized_radio"); tasklist->change_workspace_radio = WID("change_workspace_radio"); + tasklist->mouse_scroll_check = WID("mouse_scroll_check"); tasklist->minimized_windows_box = WID("minimized_windows_box"); tasklist->window_grouping_box = WID("window_grouping_box"); tasklist->window_list_content_box = WID("window_list_content_box"); @@ -1060,6 +1076,13 @@ static void setup_dialog(GtkBuilder* builder, TasklistData* tasklist) g_signal_connect(G_OBJECT(tasklist->auto_group_radio), "toggled", (GCallback) group_windows_toggled, tasklist); g_signal_connect(G_OBJECT(tasklist->always_group_radio), "toggled", (GCallback) group_windows_toggled, tasklist); + /* Mouse Scroll: */ + g_settings_bind (tasklist->settings, + "scroll-enabled", + tasklist->mouse_scroll_check, + "active", + G_SETTINGS_BIND_DEFAULT); + #ifdef HAVE_WINDOW_PREVIEWS /* change thumbnail size: */ tasklist_update_thumbnail_size_spin(tasklist); diff --git a/applets/wncklet/window-list.ui b/applets/wncklet/window-list.ui index 765b5b68..1dc961dc 100644 --- a/applets/wncklet/window-list.ui +++ b/applets/wncklet/window-list.ui @@ -387,6 +387,71 @@ </packing> </child> <child> + <object class="GtkBox" id="mouse_scroll_box"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Mouse Scrolling</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="GtkAlignment"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkCheckButton" id="mouse_scroll_check"> + <property name="label" translatable="yes">_Enable mouse scrolling</property> + <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> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> <object class="GtkBox" id="minimized_windows_box"> <property name="visible">True</property> <property name="can_focus">False</property> |