From b7bacc30da3091fb78a6aba4e9bcdd2be19ef598 Mon Sep 17 00:00:00 2001 From: Simon Steinbeiss Date: Sun, 18 Aug 2019 18:00:58 +0200 Subject: pager: Add wnck_pager_set_scroll_mode There are two scroll modes: the default 2d scroll mode is essentially only useful for touchpads, because mice cannot scroll horizontally, so scrolling up/down to get to the next workspace will get users confused. By setting the scroll_mode to 1 users get a simple way of scrolling through workspaces, irrespective of the number of rows the pager sets. https://gitlab.gnome.org/GNOME/libwnck/issues/134 Fixes: #134 --- libwnck/test-pager.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'libwnck/test-pager.c') diff --git a/libwnck/test-pager.c b/libwnck/test-pager.c index 316b13a..d60b047 100644 --- a/libwnck/test-pager.c +++ b/libwnck/test-pager.c @@ -7,6 +7,7 @@ static int n_rows = 1; static gboolean only_current = FALSE; static gboolean rtl = FALSE; static gboolean show_name = FALSE; +static gboolean simple_scrolling = FALSE; static gboolean vertical = FALSE; static gboolean wrap_on_scroll = FALSE; @@ -15,6 +16,7 @@ static GOptionEntry entries[] = { {"only-current", 'c', 0, G_OPTION_ARG_NONE, &only_current, "Only show current workspace", NULL}, {"rtl", 'r', 0, G_OPTION_ARG_NONE, &rtl, "Use RTL as default direction", NULL}, {"show-name", 's', 0, G_OPTION_ARG_NONE, &show_name, "Show workspace names instead of workspace contents", NULL}, + {"simple-scrolling", 'd', 0, G_OPTION_ARG_NONE, &simple_scrolling, "Use the simple 1d scroll mode", NULL}, {"vertical-orientation", 'v', 0, G_OPTION_ARG_NONE, &vertical, "Use a vertical orientation", NULL}, {"wrap-on-scroll", 'w', 0, G_OPTION_ARG_NONE, &wrap_on_scroll, "Wrap on scrolling over borders", NULL}, {NULL } @@ -24,6 +26,7 @@ static void create_pager_window (GtkOrientation orientation, gboolean show_all, WnckPagerDisplayMode mode, + WnckPagerScrollMode scroll_mode, int rows, gboolean wrap) { @@ -51,6 +54,7 @@ create_pager_window (GtkOrientation orientation, wnck_pager_set_show_all (WNCK_PAGER (pager), show_all); wnck_pager_set_display_mode (WNCK_PAGER (pager), mode); + wnck_pager_set_scroll_mode (WNCK_PAGER (pager), scroll_mode); wnck_pager_set_orientation (WNCK_PAGER (pager), orientation); wnck_pager_set_n_rows (WNCK_PAGER (pager), rows); wnck_pager_set_shadow_type (WNCK_PAGER (pager), GTK_SHADOW_IN); @@ -67,6 +71,7 @@ main (int argc, char **argv) GOptionContext *ctxt; GtkOrientation orientation; WnckPagerDisplayMode mode; + WnckPagerScrollMode scroll_mode; WnckScreen *screen; ctxt = g_option_context_new (""); @@ -96,7 +101,12 @@ main (int argc, char **argv) else mode = WNCK_PAGER_DISPLAY_CONTENT; - create_pager_window (orientation, !only_current, mode, n_rows, wrap_on_scroll); + if (simple_scrolling) + scroll_mode = WNCK_PAGER_SCROLL_1D; + else + scroll_mode = WNCK_PAGER_SCROLL_2D; + + create_pager_window (orientation, !only_current, mode, scroll_mode, n_rows, wrap_on_scroll); gtk_main (); -- cgit v1.2.1