summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Untz <vuntz@gnome.org>2007-02-21 18:27:42 +0000
committerVincent Untz <vuntz@src.gnome.org>2007-02-21 18:27:42 +0000
commit2aca1d41a349fdc57374b2a5dcfc4d6df521c2fb (patch)
tree13fc27a9e2ec378fe45447a644fbf2a8f3db1b7f
parent632df3a7b648e63f412fd835f4f831933b8e8738 (diff)
downloadlibwnck-2aca1d41a349fdc57374b2a5dcfc4d6df521c2fb.tar.gz
fix left/right scroll for RTL
2007-02-21 Vincent Untz <vuntz@gnome.org> * libwnck/tasklist.c: (wnck_tasklist_scroll_cb): fix left/right scroll for RTL svn path=/trunk/; revision=1186
-rw-r--r--ChangeLog5
-rw-r--r--libwnck/tasklist.c68
2 files changed, 60 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 1592f93..834a5c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-02-21 Vincent Untz <vuntz@gnome.org>
+
+ * libwnck/tasklist.c: (wnck_tasklist_scroll_cb): fix left/right scroll
+ for RTL
+
2007-02-20 Kjartan Maraas <kmaraas@gnome.org>
* Makefile.am: Dist MAINTAINERS.
diff --git a/libwnck/tasklist.c b/libwnck/tasklist.c
index 985562d..848e9f2 100644
--- a/libwnck/tasklist.c
+++ b/libwnck/tasklist.c
@@ -1692,8 +1692,9 @@ wnck_tasklist_scroll_cb (WnckTasklist *tasklist,
GdkEventScroll *event,
gpointer user_data)
{
- /* use the fact that tasklist->priv->windows is sorted is sorted
+ /* use the fact that tasklist->priv->windows is sorted
* see wnck_tasklist_size_allocate() */
+ GtkTextDirection ltr;
GList *window;
gint row = 0;
gint col = 0;
@@ -1711,6 +1712,8 @@ wnck_tasklist_scroll_cb (WnckTasklist *tasklist,
* It occurs if we change the active task too fast. */
return TRUE;
+ ltr = (gtk_widget_get_direction (GTK_WIDGET (tasklist)) != GTK_TEXT_DIR_RTL);
+
switch (event->direction)
{
case GDK_SCROLL_UP:
@@ -1727,36 +1730,75 @@ wnck_tasklist_scroll_cb (WnckTasklist *tasklist,
window = window->next;
break;
+#define TASKLIST_GET_MOST_LEFT(ltr, window, tasklist) \
+ do \
+ { \
+ if (ltr) \
+ window = tasklist->priv->windows; \
+ else \
+ window = g_list_last (tasklist->priv->windows); \
+ } while (0)
+
+#define TASKLIST_GET_MOST_RIGHT(ltr, window, tasklist) \
+ do \
+ { \
+ if (ltr) \
+ window = g_list_last (tasklist->priv->windows); \
+ else \
+ window = tasklist->priv->windows; \
+ } while (0)
+
case GDK_SCROLL_LEFT:
if (!window)
- window = g_list_last (tasklist->priv->windows);
+ TASKLIST_GET_MOST_RIGHT (ltr, window, tasklist);
else
{
/* Search the first window on the previous colomn at same row */
- while (window && (WNCK_TASK(window->data)->row != row ||
- WNCK_TASK(window->data)->col != col-1))
- window = window->prev;
- /* If no window found, select the first one */
+ if (ltr)
+ {
+ while (window && (WNCK_TASK(window->data)->row != row ||
+ WNCK_TASK(window->data)->col != col-1))
+ window = window->prev;
+ }
+ else
+ {
+ while (window && (WNCK_TASK(window->data)->row != row ||
+ WNCK_TASK(window->data)->col != col-1))
+ window = window->next;
+ }
+ /* If no window found, select the top/bottom left one */
if (!window)
- window = tasklist->priv->windows;
+ TASKLIST_GET_MOST_LEFT (ltr, window, tasklist);
}
break;
case GDK_SCROLL_RIGHT:
if (!window)
- window = tasklist->priv->windows;
+ TASKLIST_GET_MOST_LEFT (ltr, window, tasklist);
else
{
/* Search the first window on the next colomn at same row */
- while (window && (WNCK_TASK(window->data)->row != row ||
- WNCK_TASK(window->data)->col != col+1))
- window = window->next;
- /* If no window found, select the last one */
+ if (ltr)
+ {
+ while (window && (WNCK_TASK(window->data)->row != row ||
+ WNCK_TASK(window->data)->col != col+1))
+ window = window->next;
+ }
+ else
+ {
+ while (window && (WNCK_TASK(window->data)->row != row ||
+ WNCK_TASK(window->data)->col != col+1))
+ window = window->prev;
+ }
+ /* If no window found, select the top/bottom right one */
if (!window)
- window = g_list_last (tasklist->priv->windows);
+ TASKLIST_GET_MOST_RIGHT (ltr, window, tasklist);
}
break;
+#undef TASKLIST_GET_MOST_LEFT
+#undef TASKLIST_GET_MOST_RIGHT
+
default:
g_assert_not_reached ();
}