Merge lp:~cimi/overlay-scrollbar/fix-motion-after-reconnection into lp:overlay-scrollbar

Proposed by Andrea Cimitan
Status: Superseded
Proposed branch: lp:~cimi/overlay-scrollbar/fix-motion-after-reconnection
Merge into: lp:overlay-scrollbar
Diff against target: 183 lines (+83/-30) (has conflicts)
1 file modified
os/os-scrollbar.c (+83/-30)
Text conflict in os/os-scrollbar.c
To merge this branch: bzr merge lp:~cimi/overlay-scrollbar/fix-motion-after-reconnection
Reviewer Review Type Date Requested Status
Ayatana Scrollbar Team Pending
Review via email: mp+84497@code.launchpad.net

This proposal has been superseded by a proposal from 2011-12-05.

Description of the change

Fixes motion notify event after reconnection animation ended. Plus add some comments.

To post a comment you must log in.
318. By Andrea Cimitan

Updated to trunk

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'os/os-scrollbar.c'
--- os/os-scrollbar.c 2011-12-02 17:04:13 +0000
+++ os/os-scrollbar.c 2011-12-05 16:27:25 +0000
@@ -71,14 +71,15 @@
7171
72typedef enum72typedef enum
73{73{
74 OS_SIDE_TOP,74 OS_SIDE_TOP, /* Scrollbar is at top. */
75 OS_SIDE_BOTTOM,75 OS_SIDE_BOTTOM, /* Scrollbar is at bottom. */
76 OS_SIDE_LEFT,76 OS_SIDE_LEFT, /* Scrollbar is at left. */
77 OS_SIDE_RIGHT77 OS_SIDE_RIGHT /* Scrollbar is at right. */
78} OsSide;78} OsSide;
7979
80typedef enum80typedef enum
81{81{
82<<<<<<< TREE
82 OS_STATE_NONE = 0,83 OS_STATE_NONE = 0,
83 OS_STATE_CONNECTED = 1,84 OS_STATE_CONNECTED = 1,
84 OS_STATE_DETACHED = 2,85 OS_STATE_DETACHED = 2,
@@ -87,15 +88,24 @@
87 OS_STATE_INTERNAL = 16,88 OS_STATE_INTERNAL = 16,
88 OS_STATE_LOCKED = 32,89 OS_STATE_LOCKED = 32,
89 OS_STATE_RECONNECTING = 6490 OS_STATE_RECONNECTING = 64
91=======
92 OS_STATE_NONE = 0, /* No state. */
93 OS_STATE_CONNECTED = 1, /* Thumb and bar move connected, like a native scrollbar. */
94 OS_STATE_DETACHED = 2, /* The thumb is visually detached from the bar, and you can see the tail. */
95 OS_STATE_FULLSIZE = 4, /* The scrollbar is fullsize, so we hide it. */
96 OS_STATE_INTERNAL = 8, /* The thumb is touching a strut or a screen edge, it's internal. */
97 OS_STATE_LOCKED = 16, /* Thumb is locked in its position when moving in the proximity area. */
98 OS_STATE_RECONNECTING = 32 /* The thumb is reconnecting with the bar, there's likely an animation in progress. */
99>>>>>>> MERGE-SOURCE
90} OsStateFlags;100} OsStateFlags;
91101
92typedef enum102typedef enum
93{103{
94 OS_STRUT_SIDE_NONE = 0,104 OS_STRUT_SIDE_NONE = 0, /* No strut. */
95 OS_STRUT_SIDE_TOP = 1,105 OS_STRUT_SIDE_TOP = 1, /* Strut at top. */
96 OS_STRUT_SIDE_BOTTOM = 2,106 OS_STRUT_SIDE_BOTTOM = 2, /* Strut at bottom. */
97 OS_STRUT_SIDE_LEFT = 4,107 OS_STRUT_SIDE_LEFT = 4, /* Strut at left. */
98 OS_STRUT_SIDE_RIGHT = 8108 OS_STRUT_SIDE_RIGHT = 8 /* Strut at right. */
99} OsStrutSideFlags;109} OsStrutSideFlags;
100110
101typedef struct111typedef struct
@@ -996,10 +1006,55 @@
9961006
997 priv = scrollbar->priv;1007 priv = scrollbar->priv;
9981008
999 priv->state &= ~(OS_STATE_RECONNECTING);1009 /* Only update the slide values at the end of a reconnection,
10001010 * with the button pressed, otherwise it's not needed. */
1001 check_connection (scrollbar);1011 if ((priv->state & OS_STATE_RECONNECTING) &&
1002}1012 (priv->event & OS_EVENT_BUTTON_PRESS))
1013 {
1014 gint x_pos, y_pos;
1015
1016 gdk_window_get_origin (gtk_widget_get_window (priv->thumb), &x_pos, &y_pos);
1017
1018 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
1019 {
1020 priv->slide_initial_slider_position = MIN (priv->slider.y, priv->overlay.y);
1021 priv->slide_initial_coordinate = y_pos + priv->pointer.y;
1022 }
1023 else
1024 {
1025 priv->slide_initial_slider_position = MIN (priv->slider.x, priv->overlay.x);
1026 priv->slide_initial_coordinate = x_pos + priv->pointer.x;
1027 }
1028 }
1029
1030 /* Check if the thumb can be considered connected after the animation. */
1031 check_connection (scrollbar);
1032
1033 /* Unset OS_STATE_RECONNECTING since the animation ended. */
1034 priv->state &= ~(OS_STATE_RECONNECTING);
1035}
1036
1037/* Stop function called by the scrolling animation. */
1038static void
1039scrolling_stop_cb (gpointer user_data)
1040{
1041 OsScrollbar *scrollbar;
1042 OsScrollbarPrivate *priv;
1043
1044 scrollbar = OS_SCROLLBAR (user_data);
1045
1046 priv = scrollbar->priv;
1047
1048 /* No slide values update here,
1049 * handle them separately! */
1050
1051 /* Check if the thumb can be considered connected after the animation. */
1052 check_connection (scrollbar);
1053
1054 /* Unset OS_STATE_RECONNECTING since the animation ended. */
1055 priv->state &= ~(OS_STATE_RECONNECTING);
1056}
1057
10031058
1004/* Swap adjustment pointer. */1059/* Swap adjustment pointer. */
1005static void1060static void
@@ -1521,29 +1576,17 @@
1521 {1576 {
1522 /* Reconnect the thumb with the bar. */1577 /* Reconnect the thumb with the bar. */
1523 gdouble new_value;1578 gdouble new_value;
1524 gint c, delta;1579 gint c;
1525 gint32 duration;1580 gint32 duration;
15261581
1527 if (priv->orientation == GTK_ORIENTATION_VERTICAL)1582 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
1528 {1583 c = event->y_root - priv->thumb_win.y - event->y;
1529 priv->slide_initial_slider_position = event->y_root - priv->thumb_win.y - event->y;
1530 priv->slide_initial_coordinate = event->y_root;
1531
1532 delta = event->y_root - priv->slide_initial_coordinate;
1533 }
1534 else1584 else
1535 {1585 c = event->x_root - priv->thumb_win.x - event->x;
1536 priv->slide_initial_slider_position = event->x_root - priv->thumb_win.x - event->x;
1537 priv->slide_initial_coordinate = event->x_root;
1538
1539 delta = event->x_root - priv->slide_initial_coordinate;
1540 }
1541
1542 c = priv->slide_initial_slider_position + delta;
15431586
1544 /* If a scrolling animation is running,1587 /* If a scrolling animation is running,
1545 * stop it and add the new value. */1588 * stop it and add the new value. */
1546 os_animation_stop (priv->animation, NULL);1589 os_animation_stop (priv->animation, scrolling_stop_cb);
15471590
1548 new_value = coord_to_value (scrollbar, c);1591 new_value = coord_to_value (scrollbar, c);
15491592
@@ -1603,8 +1646,13 @@
1603 * stop it and add the new value. */1646 * stop it and add the new value. */
1604 if (os_animation_is_running (priv->animation))1647 if (os_animation_is_running (priv->animation))
1605 {1648 {
1649<<<<<<< TREE
1606 os_animation_stop (priv->animation, NULL);1650 os_animation_stop (priv->animation, NULL);
1607 new_value = priv->value + increment;1651 new_value = priv->value + increment;
1652=======
1653 os_animation_stop (priv->animation, scrolling_stop_cb);
1654 new_value = priv->value + gtk_adjustment_get_page_increment (priv->adjustment);
1655>>>>>>> MERGE-SOURCE
1608 }1656 }
1609 else1657 else
1610 new_value = gtk_adjustment_get_value (priv->adjustment) + increment;1658 new_value = gtk_adjustment_get_value (priv->adjustment) + increment;
@@ -1650,8 +1698,13 @@
1650 * stop it and subtract the new value. */1698 * stop it and subtract the new value. */
1651 if (os_animation_is_running (priv->animation))1699 if (os_animation_is_running (priv->animation))
1652 {1700 {
1701<<<<<<< TREE
1653 os_animation_stop (priv->animation, NULL);1702 os_animation_stop (priv->animation, NULL);
1654 new_value = priv->value - increment;1703 new_value = priv->value - increment;
1704=======
1705 os_animation_stop (priv->animation, scrolling_stop_cb);
1706 new_value = priv->value - gtk_adjustment_get_page_increment (priv->adjustment);
1707>>>>>>> MERGE-SOURCE
1655 }1708 }
1656 else1709 else
1657 new_value = gtk_adjustment_get_value (priv->adjustment) - increment;1710 new_value = gtk_adjustment_get_value (priv->adjustment) - increment;
@@ -1950,7 +2003,7 @@
1950 else2003 else
1951 {2004 {
1952 /* Stop the paging animation now. */2005 /* Stop the paging animation now. */
1953 os_animation_stop (priv->animation, NULL);2006 os_animation_stop (priv->animation, scrolling_stop_cb);
1954 }2007 }
1955 }2008 }
19562009

Subscribers

People subscribed via source and target branches