summaryrefslogtreecommitdiff
path: root/libwnck/test-pager.c
diff options
context:
space:
mode:
authorSimon Steinbeiss <simon.steinbeiss@elfenbeinturm.at>2019-08-18 18:00:58 +0200
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2019-09-10 16:03:26 +0000
commitb7bacc30da3091fb78a6aba4e9bcdd2be19ef598 (patch)
tree8c328a6256be8e6954dd6b60989a07a3b168319e /libwnck/test-pager.c
parent28ca9c47d7ea0b78b5b07b6b87853909cab2bf52 (diff)
downloadlibwnck-b7bacc30da3091fb78a6aba4e9bcdd2be19ef598.tar.gz
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
Diffstat (limited to 'libwnck/test-pager.c')
-rw-r--r--libwnck/test-pager.c12
1 files changed, 11 insertions, 1 deletions
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 ();