Merge lp:~cimi/overlay-scrollbar/fix-822806 into lp:overlay-scrollbar
- fix-822806
- Merge into trunk
Proposed by
Andrea Cimitan
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Ted Gould | ||||
Approved revision: | 297 | ||||
Merged at revision: | 297 | ||||
Proposed branch: | lp:~cimi/overlay-scrollbar/fix-822806 | ||||
Merge into: | lp:overlay-scrollbar | ||||
Diff against target: |
539 lines (+280/-221) 1 file modified
os/os-scrollbar.c (+280/-221) |
||||
To merge this branch: | bzr merge lp:~cimi/overlay-scrollbar/fix-822806 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ted Gould (community) | Approve | ||
Review via email: mp+70796@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'os/os-scrollbar.c' | |||
2 | --- os/os-scrollbar.c 2011-07-14 14:35:59 +0000 | |||
3 | +++ os/os-scrollbar.c 2011-08-08 21:52:33 +0000 | |||
4 | @@ -1953,7 +1953,7 @@ | |||
5 | 1953 | OsScrollbarPrivate *priv; | 1953 | OsScrollbarPrivate *priv; |
6 | 1954 | 1954 | ||
7 | 1955 | priv = scrollbar->priv; | 1955 | priv = scrollbar->priv; |
9 | 1956 | 1956 | ||
10 | 1957 | switch (priv->side) | 1957 | switch (priv->side) |
11 | 1958 | { | 1958 | { |
12 | 1959 | case OS_SIDE_RIGHT: | 1959 | case OS_SIDE_RIGHT: |
13 | @@ -1989,6 +1989,15 @@ | |||
14 | 1989 | 1989 | ||
15 | 1990 | /* filter function applied to the toplevel window */ | 1990 | /* filter function applied to the toplevel window */ |
16 | 1991 | #ifdef USE_GTK3 | 1991 | #ifdef USE_GTK3 |
17 | 1992 | typedef enum | ||
18 | 1993 | { | ||
19 | 1994 | OS_XEVENT_NONE, | ||
20 | 1995 | OS_XEVENT_BUTTON_PRESS, | ||
21 | 1996 | OS_XEVENT_BUTTON_RELEASE, | ||
22 | 1997 | OS_XEVENT_LEAVE, | ||
23 | 1998 | OS_XEVENT_MOTION | ||
24 | 1999 | } OsXEvent; | ||
25 | 2000 | |||
26 | 1992 | static GdkFilterReturn | 2001 | static GdkFilterReturn |
27 | 1993 | window_filter_func (GdkXEvent *gdkxevent, | 2002 | window_filter_func (GdkXEvent *gdkxevent, |
28 | 1994 | GdkEvent *event, | 2003 | GdkEvent *event, |
29 | @@ -2010,93 +2019,144 @@ | |||
30 | 2010 | 2019 | ||
31 | 2011 | if (!priv->fullsize) | 2020 | if (!priv->fullsize) |
32 | 2012 | { | 2021 | { |
33 | 2022 | OsXEvent os_xevent; | ||
34 | 2023 | gdouble event_x, event_y; | ||
35 | 2024 | |||
36 | 2025 | os_xevent = OS_XEVENT_NONE; | ||
37 | 2026 | |||
38 | 2013 | if (xev->type == GenericEvent) | 2027 | if (xev->type == GenericEvent) |
39 | 2014 | { | 2028 | { |
40 | 2029 | /* Deal with XInput 2 events */ | ||
41 | 2015 | XIDeviceEvent *xiev; | 2030 | XIDeviceEvent *xiev; |
42 | 2016 | 2031 | ||
43 | 2017 | xiev = xev->xcookie.data; | 2032 | xiev = xev->xcookie.data; |
44 | 2018 | 2033 | ||
45 | 2019 | if (xiev->evtype == XI_ButtonPress) | 2034 | if (xiev->evtype == XI_ButtonPress) |
126 | 2020 | { | 2035 | os_xevent = OS_XEVENT_BUTTON_PRESS; |
127 | 2021 | priv->toplevel_button_press = TRUE; | 2036 | |
128 | 2022 | gtk_widget_hide (priv->thumb); | 2037 | if (xiev->evtype == XI_ButtonRelease) |
129 | 2023 | } | 2038 | { |
130 | 2024 | 2039 | os_xevent = OS_XEVENT_BUTTON_RELEASE; | |
131 | 2025 | if (priv->toplevel_button_press && xiev->evtype == XI_ButtonRelease) | 2040 | event_x = xiev->event_x; |
132 | 2026 | { | 2041 | event_y = xiev->event_y; |
133 | 2027 | priv->toplevel_button_press = FALSE; | 2042 | } |
134 | 2028 | 2043 | ||
135 | 2029 | /* proximity area */ | 2044 | if (xiev->evtype == XI_Leave) |
136 | 2030 | if (priv->orientation == GTK_ORIENTATION_VERTICAL) | 2045 | os_xevent = OS_XEVENT_LEAVE; |
137 | 2031 | { | 2046 | |
138 | 2032 | if (check_proximity (scrollbar, xiev->event_x, xiev->event_y)) | 2047 | if (xiev->evtype == XI_Motion) |
139 | 2033 | { | 2048 | { |
140 | 2034 | priv->can_hide = FALSE; | 2049 | os_xevent = OS_XEVENT_MOTION; |
141 | 2035 | 2050 | event_x = xiev->event_x; | |
142 | 2036 | if (priv->lock_position) | 2051 | event_y = xiev->event_y; |
143 | 2037 | return GDK_FILTER_CONTINUE; | 2052 | } |
144 | 2038 | 2053 | } | |
145 | 2039 | if (priv->overlay.height > priv->slider.height) | 2054 | else |
146 | 2040 | { | 2055 | { |
147 | 2041 | gint x, y, x_pos, y_pos; | 2056 | /* Deal with X core events, when apps (like rhythmbox), |
148 | 2042 | 2057 | * are using gdk_disable_miltidevice () */ | |
149 | 2043 | gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos); | 2058 | if (xev->type == ButtonPress) |
150 | 2044 | 2059 | os_xevent = OS_XEVENT_BUTTON_PRESS; | |
151 | 2045 | x = priv->thumb_all.x; | 2060 | |
152 | 2046 | y = CLAMP (xiev->event_y - priv->slider.height / 2, | 2061 | if (xev->type == ButtonRelease) |
153 | 2047 | priv->thumb_all.y + priv->overlay.y, | 2062 | { |
154 | 2048 | priv->thumb_all.y + priv->overlay.y + priv->overlay.height - priv->slider.height); | 2063 | os_xevent = OS_XEVENT_BUTTON_RELEASE; |
155 | 2049 | 2064 | event_x = xev->xbutton.x; | |
156 | 2050 | move_thumb (scrollbar, x_pos + x, y_pos + y); | 2065 | event_y = xev->xbutton.y; |
157 | 2051 | } | 2066 | } |
158 | 2052 | else | 2067 | |
159 | 2053 | { | 2068 | if (xev->type == LeaveNotify) |
160 | 2054 | move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y); | 2069 | os_xevent = OS_XEVENT_LEAVE; |
161 | 2055 | } | 2070 | |
162 | 2056 | 2071 | if (xev->type == MotionNotify) | |
163 | 2057 | gtk_widget_show (priv->thumb); | 2072 | { |
164 | 2058 | } | 2073 | os_xevent = OS_XEVENT_MOTION; |
165 | 2059 | } | 2074 | event_x = xev->xmotion.x; |
166 | 2060 | else | 2075 | event_y = xev->xmotion.y; |
167 | 2061 | { | 2076 | } |
168 | 2062 | if (check_proximity (scrollbar, xiev->event_x, xiev->event_y)) | 2077 | } |
169 | 2063 | { | 2078 | |
170 | 2064 | priv->can_hide = FALSE; | 2079 | if (os_xevent == OS_XEVENT_BUTTON_PRESS) |
171 | 2065 | 2080 | { | |
172 | 2066 | if (priv->lock_position) | 2081 | priv->toplevel_button_press = TRUE; |
173 | 2067 | return GDK_FILTER_CONTINUE; | 2082 | gtk_widget_hide (priv->thumb); |
174 | 2068 | 2083 | } | |
175 | 2069 | if (priv->overlay.width > priv->slider.width) | 2084 | |
176 | 2070 | { | 2085 | if (priv->toplevel_button_press && os_xevent == OS_XEVENT_BUTTON_RELEASE) |
177 | 2071 | gint x, y, x_pos, y_pos; | 2086 | { |
178 | 2072 | 2087 | priv->toplevel_button_press = FALSE; | |
179 | 2073 | gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos); | 2088 | |
180 | 2074 | 2089 | /* proximity area */ | |
181 | 2075 | x = CLAMP (xiev->event_x - priv->slider.width / 2, | 2090 | if (priv->orientation == GTK_ORIENTATION_VERTICAL) |
182 | 2076 | priv->thumb_all.x + priv->overlay.x, | 2091 | { |
183 | 2077 | priv->thumb_all.x + priv->overlay.x + priv->overlay.width - priv->slider.width); | 2092 | if (check_proximity (scrollbar, event_x, event_y)) |
184 | 2078 | y = priv->thumb_all.y; | 2093 | { |
185 | 2079 | 2094 | priv->can_hide = FALSE; | |
186 | 2080 | move_thumb (scrollbar, x_pos + x, y_pos + y); | 2095 | |
187 | 2081 | } | 2096 | if (priv->lock_position) |
188 | 2082 | else | 2097 | return GDK_FILTER_CONTINUE; |
189 | 2083 | { | 2098 | |
190 | 2084 | move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y); | 2099 | if (priv->overlay.height > priv->slider.height) |
191 | 2085 | } | 2100 | { |
192 | 2086 | 2101 | gint x, y, x_pos, y_pos; | |
193 | 2087 | gtk_widget_show (priv->thumb); | 2102 | |
194 | 2088 | } | 2103 | gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos); |
195 | 2089 | } | 2104 | |
196 | 2090 | } | 2105 | x = priv->thumb_all.x; |
197 | 2091 | 2106 | y = CLAMP (event_y - priv->slider.height / 2, | |
198 | 2092 | /* after a scroll-event, without motion, | 2107 | priv->thumb_all.y + priv->overlay.y, |
199 | 2093 | * pager becomes inactive because the timeout in | 2108 | priv->thumb_all.y + priv->overlay.y + priv->overlay.height - priv->slider.height); |
200 | 2094 | * leave-notify-event starts, | 2109 | |
201 | 2095 | * this call checks the pointer after the scroll-event, | 2110 | move_thumb (scrollbar, x_pos + x, y_pos + y); |
202 | 2096 | * since it enters the window, | 2111 | } |
203 | 2097 | * then sets the state accordingly. */ | 2112 | else |
204 | 2098 | 2113 | { | |
205 | 2099 | /* FIXME(Cimi) code commented out until I find what and where is wrong. */ | 2114 | move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y); |
206 | 2115 | } | ||
207 | 2116 | |||
208 | 2117 | gtk_widget_show (priv->thumb); | ||
209 | 2118 | } | ||
210 | 2119 | } | ||
211 | 2120 | else | ||
212 | 2121 | { | ||
213 | 2122 | if (check_proximity (scrollbar, event_x, event_y)) | ||
214 | 2123 | { | ||
215 | 2124 | priv->can_hide = FALSE; | ||
216 | 2125 | |||
217 | 2126 | if (priv->lock_position) | ||
218 | 2127 | return GDK_FILTER_CONTINUE; | ||
219 | 2128 | |||
220 | 2129 | if (priv->overlay.width > priv->slider.width) | ||
221 | 2130 | { | ||
222 | 2131 | gint x, y, x_pos, y_pos; | ||
223 | 2132 | |||
224 | 2133 | gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos); | ||
225 | 2134 | |||
226 | 2135 | x = CLAMP (event_x - priv->slider.width / 2, | ||
227 | 2136 | priv->thumb_all.x + priv->overlay.x, | ||
228 | 2137 | priv->thumb_all.x + priv->overlay.x + priv->overlay.width - priv->slider.width); | ||
229 | 2138 | y = priv->thumb_all.y; | ||
230 | 2139 | |||
231 | 2140 | move_thumb (scrollbar, x_pos + x, y_pos + y); | ||
232 | 2141 | } | ||
233 | 2142 | else | ||
234 | 2143 | { | ||
235 | 2144 | move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y); | ||
236 | 2145 | } | ||
237 | 2146 | |||
238 | 2147 | gtk_widget_show (priv->thumb); | ||
239 | 2148 | } | ||
240 | 2149 | } | ||
241 | 2150 | } | ||
242 | 2151 | |||
243 | 2152 | /* after a scroll-event, without motion, | ||
244 | 2153 | * pager becomes inactive because the timeout in | ||
245 | 2154 | * leave-notify-event starts, | ||
246 | 2155 | * this call checks the pointer after the scroll-event, | ||
247 | 2156 | * since it enters the window, | ||
248 | 2157 | * then sets the state accordingly. */ | ||
249 | 2158 | |||
250 | 2159 | /* FIXME(Cimi) code commented out until I find what and where is wrong. */ | ||
251 | 2100 | // if (!priv->active_window && xiev->evtype == XI_Enter) | 2160 | // if (!priv->active_window && xiev->evtype == XI_Enter) |
252 | 2101 | // { | 2161 | // { |
253 | 2102 | // XIEnterEvent *xiee = xev->xcookie.data; | 2162 | // XIEnterEvent *xiee = xev->xcookie.data; |
254 | @@ -2106,147 +2166,146 @@ | |||
255 | 2106 | // pager_set_state_from_pointer (scrollbar, xiee->event_x, xiee->event_y); | 2166 | // pager_set_state_from_pointer (scrollbar, xiee->event_x, xiee->event_y); |
256 | 2107 | // } | 2167 | // } |
257 | 2108 | 2168 | ||
281 | 2109 | if (xiev->evtype == XI_Leave) | 2169 | if (os_xevent == OS_XEVENT_LEAVE) |
282 | 2110 | { | 2170 | { |
283 | 2111 | /* never deactivate the pager in an active window. */ | 2171 | /* never deactivate the pager in an active window. */ |
284 | 2112 | if (!priv->active_window) | 2172 | if (!priv->active_window) |
285 | 2113 | { | 2173 | { |
286 | 2114 | priv->can_deactivate_pager = TRUE; | 2174 | priv->can_deactivate_pager = TRUE; |
287 | 2115 | 2175 | ||
288 | 2116 | if (priv->source_deactivate_pager_id != 0) | 2176 | if (priv->source_deactivate_pager_id != 0) |
289 | 2117 | g_source_remove (priv->source_deactivate_pager_id); | 2177 | g_source_remove (priv->source_deactivate_pager_id); |
290 | 2118 | 2178 | ||
291 | 2119 | priv->source_deactivate_pager_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE, | 2179 | priv->source_deactivate_pager_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE, |
292 | 2120 | deactivate_pager_cb, | 2180 | deactivate_pager_cb, |
293 | 2121 | scrollbar); | 2181 | scrollbar); |
294 | 2122 | } | 2182 | } |
295 | 2123 | 2183 | ||
296 | 2124 | priv->toplevel_button_press = FALSE; | 2184 | priv->toplevel_button_press = FALSE; |
297 | 2125 | priv->can_hide = TRUE; | 2185 | priv->can_hide = TRUE; |
298 | 2126 | 2186 | ||
299 | 2127 | if (priv->source_hide_thumb_id != 0) | 2187 | if (priv->source_hide_thumb_id != 0) |
300 | 2128 | g_source_remove (priv->source_hide_thumb_id); | 2188 | g_source_remove (priv->source_hide_thumb_id); |
301 | 2129 | 2189 | ||
302 | 2130 | priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE, | 2190 | priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE, |
303 | 2131 | hide_thumb_cb, | 2191 | hide_thumb_cb, |
304 | 2192 | scrollbar); | ||
305 | 2193 | |||
306 | 2194 | if (priv->source_unlock_thumb_id != 0) | ||
307 | 2195 | g_source_remove (priv->source_unlock_thumb_id); | ||
308 | 2196 | |||
309 | 2197 | priv->source_unlock_thumb_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE, | ||
310 | 2198 | unlock_thumb_cb, | ||
311 | 2132 | scrollbar); | 2199 | scrollbar); |
429 | 2133 | 2200 | } | |
430 | 2134 | if (priv->source_unlock_thumb_id != 0) | 2201 | |
431 | 2135 | g_source_remove (priv->source_unlock_thumb_id); | 2202 | /* get the motion_notify_event trough XEvent */ |
432 | 2136 | 2203 | if (!priv->toplevel_button_press && os_xevent == OS_XEVENT_MOTION) | |
433 | 2137 | priv->source_unlock_thumb_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE, | 2204 | { |
434 | 2138 | unlock_thumb_cb, | 2205 | /* react to motion_notify_event |
435 | 2139 | scrollbar); | 2206 | * and set the state accordingly. */ |
436 | 2140 | } | 2207 | if (!is_insensitive (scrollbar) && !priv->active_window) |
437 | 2141 | 2208 | pager_set_state_from_pointer (scrollbar, event_x, event_y); | |
438 | 2142 | /* get the motion_notify_event trough XEvent */ | 2209 | |
439 | 2143 | if (!priv->toplevel_button_press && xiev->evtype == XI_Motion) | 2210 | /* proximity area */ |
440 | 2144 | { | 2211 | if (priv->orientation == GTK_ORIENTATION_VERTICAL) |
441 | 2145 | /* react to motion_notify_event | 2212 | { |
442 | 2146 | * and set the state accordingly. */ | 2213 | if (check_proximity (scrollbar, event_x, event_y)) |
443 | 2147 | if (!is_insensitive (scrollbar) && !priv->active_window) | 2214 | { |
444 | 2148 | pager_set_state_from_pointer (scrollbar, xiev->event_x, xiev->event_y); | 2215 | priv->can_hide = FALSE; |
445 | 2149 | 2216 | ||
446 | 2150 | /* proximity area */ | 2217 | if (priv->source_hide_thumb_id != 0) |
447 | 2151 | if (priv->orientation == GTK_ORIENTATION_VERTICAL) | 2218 | { |
448 | 2152 | { | 2219 | g_source_remove (priv->source_hide_thumb_id); |
449 | 2153 | if (check_proximity (scrollbar, xiev->event_x, xiev->event_y)) | 2220 | priv->source_hide_thumb_id = 0; |
450 | 2154 | { | 2221 | } |
451 | 2155 | priv->can_hide = FALSE; | 2222 | |
452 | 2156 | 2223 | if (priv->lock_position) | |
453 | 2157 | if (priv->source_hide_thumb_id != 0) | 2224 | return GDK_FILTER_CONTINUE; |
454 | 2158 | { | 2225 | |
455 | 2159 | g_source_remove (priv->source_hide_thumb_id); | 2226 | if (priv->overlay.height > priv->slider.height) |
456 | 2160 | priv->source_hide_thumb_id = 0; | 2227 | { |
457 | 2161 | } | 2228 | gint x, y, x_pos, y_pos; |
458 | 2162 | 2229 | ||
459 | 2163 | if (priv->lock_position) | 2230 | gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos); |
460 | 2164 | return GDK_FILTER_CONTINUE; | 2231 | |
461 | 2165 | 2232 | x = priv->thumb_all.x; | |
462 | 2166 | if (priv->overlay.height > priv->slider.height) | 2233 | y = CLAMP (event_y - priv->slider.height / 2, |
463 | 2167 | { | 2234 | priv->thumb_all.y + priv->overlay.y, |
464 | 2168 | gint x, y, x_pos, y_pos; | 2235 | priv->thumb_all.y + priv->overlay.y + priv->overlay.height - priv->slider.height); |
465 | 2169 | 2236 | ||
466 | 2170 | gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos); | 2237 | move_thumb (scrollbar, x_pos + x, y_pos + y); |
467 | 2171 | 2238 | } | |
468 | 2172 | x = priv->thumb_all.x; | 2239 | else |
469 | 2173 | y = CLAMP (xiev->event_y - priv->slider.height / 2, | 2240 | { |
470 | 2174 | priv->thumb_all.y + priv->overlay.y, | 2241 | move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y); |
471 | 2175 | priv->thumb_all.y + priv->overlay.y + priv->overlay.height - priv->slider.height); | 2242 | } |
472 | 2176 | 2243 | ||
473 | 2177 | move_thumb (scrollbar, x_pos + x, y_pos + y); | 2244 | os_pager_set_detached (priv->pager, FALSE); |
474 | 2178 | } | 2245 | os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE); |
475 | 2179 | else | 2246 | gtk_widget_show (priv->thumb); |
476 | 2180 | { | 2247 | } |
477 | 2181 | move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y); | 2248 | else |
478 | 2182 | } | 2249 | { |
479 | 2183 | 2250 | priv->can_hide = TRUE; | |
480 | 2184 | os_pager_set_detached (priv->pager, FALSE); | 2251 | priv->lock_position = FALSE; |
481 | 2185 | os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE); | 2252 | |
482 | 2186 | gtk_widget_show (priv->thumb); | 2253 | if (gtk_widget_get_mapped (priv->thumb) && |
483 | 2187 | } | 2254 | priv->source_hide_thumb_id == 0) |
484 | 2188 | else | 2255 | priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_PROXIMITY_HIDE, |
485 | 2189 | { | 2256 | hide_thumb_cb, |
486 | 2190 | priv->can_hide = TRUE; | 2257 | scrollbar); |
487 | 2191 | priv->lock_position = FALSE; | 2258 | } |
488 | 2192 | 2259 | } | |
489 | 2193 | if (gtk_widget_get_mapped (priv->thumb) && | 2260 | else |
490 | 2194 | priv->source_hide_thumb_id == 0) | 2261 | { |
491 | 2195 | priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_PROXIMITY_HIDE, | 2262 | if (check_proximity (scrollbar, event_x, event_y)) |
492 | 2196 | hide_thumb_cb, | 2263 | { |
493 | 2197 | scrollbar); | 2264 | priv->can_hide = FALSE; |
494 | 2198 | } | 2265 | |
495 | 2199 | } | 2266 | if (priv->source_hide_thumb_id != 0) |
496 | 2200 | else | 2267 | { |
497 | 2201 | { | 2268 | g_source_remove (priv->source_hide_thumb_id); |
498 | 2202 | if (check_proximity (scrollbar, xiev->event_x, xiev->event_y)) | 2269 | priv->source_hide_thumb_id = 0; |
499 | 2203 | { | 2270 | } |
500 | 2204 | priv->can_hide = FALSE; | 2271 | |
501 | 2205 | 2272 | if (priv->lock_position) | |
502 | 2206 | if (priv->source_hide_thumb_id != 0) | 2273 | return GDK_FILTER_CONTINUE; |
503 | 2207 | { | 2274 | |
504 | 2208 | g_source_remove (priv->source_hide_thumb_id); | 2275 | if (priv->overlay.width > priv->slider.width) |
505 | 2209 | priv->source_hide_thumb_id = 0; | 2276 | { |
506 | 2210 | } | 2277 | gint x, y, x_pos, y_pos; |
507 | 2211 | 2278 | ||
508 | 2212 | if (priv->lock_position) | 2279 | gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos); |
509 | 2213 | return GDK_FILTER_CONTINUE; | 2280 | |
510 | 2214 | 2281 | x = CLAMP (event_x - priv->slider.width / 2, | |
511 | 2215 | if (priv->overlay.width > priv->slider.width) | 2282 | priv->thumb_all.x + priv->overlay.x, |
512 | 2216 | { | 2283 | priv->thumb_all.x + priv->overlay.x + priv->overlay.width - priv->slider.width); |
513 | 2217 | gint x, y, x_pos, y_pos; | 2284 | y = priv->thumb_all.y; |
514 | 2218 | 2285 | ||
515 | 2219 | gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos); | 2286 | move_thumb (scrollbar, x_pos + x, y_pos + y); |
516 | 2220 | 2287 | } | |
517 | 2221 | x = CLAMP (xiev->event_x - priv->slider.width / 2, | 2288 | else |
518 | 2222 | priv->thumb_all.x + priv->overlay.x, | 2289 | { |
519 | 2223 | priv->thumb_all.x + priv->overlay.x + priv->overlay.width - priv->slider.width); | 2290 | move_thumb (scrollbar, priv->win_x + priv->slider.x, priv->win_y); |
520 | 2224 | y = priv->thumb_all.y; | 2291 | } |
521 | 2225 | 2292 | ||
522 | 2226 | move_thumb (scrollbar, x_pos + x, y_pos + y); | 2293 | os_pager_set_detached (priv->pager, FALSE); |
523 | 2227 | } | 2294 | os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE); |
524 | 2228 | else | 2295 | gtk_widget_show (priv->thumb); |
525 | 2229 | { | 2296 | } |
526 | 2230 | move_thumb (scrollbar, priv->win_x + priv->slider.x, priv->win_y); | 2297 | else |
527 | 2231 | } | 2298 | { |
528 | 2232 | 2299 | priv->can_hide = TRUE; | |
529 | 2233 | os_pager_set_detached (priv->pager, FALSE); | 2300 | priv->lock_position = FALSE; |
530 | 2234 | os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE); | 2301 | |
531 | 2235 | gtk_widget_show (priv->thumb); | 2302 | if (gtk_widget_get_mapped (priv->thumb) && |
532 | 2236 | } | 2303 | priv->source_hide_thumb_id == 0) |
533 | 2237 | else | 2304 | priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_PROXIMITY_HIDE, |
534 | 2238 | { | 2305 | hide_thumb_cb, |
535 | 2239 | priv->can_hide = TRUE; | 2306 | scrollbar); |
536 | 2240 | priv->lock_position = FALSE; | 2307 | } |
537 | 2241 | 2308 | } | |
421 | 2242 | if (gtk_widget_get_mapped (priv->thumb) && | ||
422 | 2243 | priv->source_hide_thumb_id == 0) | ||
423 | 2244 | priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_PROXIMITY_HIDE, | ||
424 | 2245 | hide_thumb_cb, | ||
425 | 2246 | scrollbar); | ||
426 | 2247 | } | ||
427 | 2248 | } | ||
428 | 2249 | } | ||
538 | 2250 | } | 2309 | } |
539 | 2251 | } | 2310 | } |
540 | 2252 | 2311 |