diff options
author | monsta <[email protected]> | 2017-04-03 15:00:29 +0300 |
---|---|---|
committer | monsta <[email protected]> | 2017-04-03 15:32:01 +0300 |
commit | 302cefd66a6a0051a8e06eac5bdbebdac01c3de5 (patch) | |
tree | ec5d64482910e498e323794054c3fe34eed91d3b | |
parent | 603fa8b49c1f6366461a2595716272c0ff3de7a5 (diff) | |
download | mate-panel-302cefd66a6a0051a8e06eac5bdbebdac01c3de5.tar.bz2 mate-panel-302cefd66a6a0051a8e06eac5bdbebdac01c3de5.tar.xz |
workspace switcher: enable wrap on scroll for GTK+3 too
port of 7d55c5a174884d5f2f301c5ea183fb70dea26363 to mixed GTK+2/3 code
-rw-r--r-- | applets/wncklet/workspace-switcher.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/applets/wncklet/workspace-switcher.c b/applets/wncklet/workspace-switcher.c index f61ba4cc..eb02adfe 100644 --- a/applets/wncklet/workspace-switcher.c +++ b/applets/wncklet/workspace-switcher.c @@ -249,7 +249,6 @@ static void applet_change_background(MatePanelApplet* applet, MatePanelAppletBac #endif } -#if !GTK_CHECK_VERSION (3, 0, 0) static gboolean applet_scroll(MatePanelApplet* applet, GdkEventScroll* event, PagerData* pager) { GdkScrollDirection absolute_direction; @@ -261,6 +260,11 @@ static gboolean applet_scroll(MatePanelApplet* applet, GdkEventScroll* event, Pa if (event->type != GDK_SCROLL) return FALSE; +#if GTK_CHECK_VERSION (3, 0, 0) + if (event->direction == GDK_SCROLL_SMOOTH) + return FALSE; +#endif + index = wnck_workspace_get_number(wnck_screen_get_active_workspace(pager->screen)); n_workspaces = wnck_screen_get_workspace_count(pager->screen); n_columns = n_workspaces / pager->n_rows; @@ -276,15 +280,14 @@ static gboolean applet_scroll(MatePanelApplet* applet, GdkEventScroll* event, Pa { switch (event->direction) { - case GDK_SCROLL_DOWN: - case GDK_SCROLL_UP: - break; case GDK_SCROLL_RIGHT: absolute_direction = GDK_SCROLL_LEFT; break; case GDK_SCROLL_LEFT: absolute_direction = GDK_SCROLL_RIGHT; break; + default: + break; } } @@ -353,7 +356,6 @@ static gboolean applet_scroll(MatePanelApplet* applet, GdkEventScroll* event, Pa return TRUE; } -#endif static void destroy_pager(GtkWidget* widget, PagerData* pager) { @@ -578,6 +580,11 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet) #endif g_signal_connect(G_OBJECT(pager->pager), "destroy", G_CALLBACK(destroy_pager), pager); +#if GTK_CHECK_VERSION (3, 0, 0) + /* overwrite default WnckPager widget scroll-event */ + g_signal_connect(G_OBJECT(pager->pager), "scroll-event", G_CALLBACK(applet_scroll), pager); +#endif + gtk_container_add(GTK_CONTAINER(pager->applet), pager->pager); gtk_widget_show(pager->pager); |