Merge lp:~azzar1/overlay-scrollbar/fix-736992 into lp:overlay-scrollbar

Proposed by Andrea Azzarone
Status: Merged
Merged at revision: 183
Proposed branch: lp:~azzar1/overlay-scrollbar/fix-736992
Merge into: lp:overlay-scrollbar
Diff against target: 95 lines (+30/-22)
1 file modified
os/os-scrollbar.c (+30/-22)
To merge this branch: bzr merge lp:~azzar1/overlay-scrollbar/fix-736992
Reviewer Review Type Date Requested Status
Andrea Cimitan Approve
Review via email: mp+55599@code.launchpad.net

Description of the change

Thanks to Andrea Cimitan for the help!

To post a comment you must log in.
185. By Andrea Azzarone

Other fixes!

Revision history for this message
Andrea Cimitan (cimi) wrote :

looks fine to me, well done

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-03-29 12:18:39 +0000
3+++ os/os-scrollbar.c 2011-03-30 17:06:39 +0000
4@@ -85,8 +85,8 @@
5 static void os_scrollbar_move_thumb (OsScrollbar *scrollbar, gint x, gint y);
6 static void os_scrollbar_notify_adjustment_cb (GObject *object, gpointer user_data);
7 static void os_scrollbar_notify_orientation_cb (GObject *object, gpointer user_data);
8-static gint os_scrollbar_sanitize_x (OsScrollbar *scrollbar, gint x);
9-static gint os_scrollbar_sanitize_y (OsScrollbar *scrollbar, gint y);
10+static gint os_scrollbar_sanitize_x (OsScrollbar *scrollbar, gint x, gint y);
11+static gint os_scrollbar_sanitize_y (OsScrollbar *scrollbar, gint x, gint y);
12 static void os_scrollbar_store_window_position (OsScrollbar *scrollbar);
13 static void os_scrollbar_swap_adjustment (OsScrollbar *scrollbar, GtkAdjustment *adjustment);
14 static void os_scrollbar_swap_thumb (OsScrollbar *scrollbar, GtkWidget *thumb);
15@@ -390,8 +390,8 @@
16 priv = scrollbar->priv;
17
18 gtk_window_move (GTK_WINDOW (priv->thumb),
19- os_scrollbar_sanitize_x (scrollbar, x),
20- os_scrollbar_sanitize_y (scrollbar, y));
21+ os_scrollbar_sanitize_x (scrollbar, x, y),
22+ os_scrollbar_sanitize_y (scrollbar, x, y));
23 }
24
25 static void
26@@ -424,21 +424,25 @@
27
28 static gint
29 os_scrollbar_sanitize_x (OsScrollbar *scrollbar,
30- gint x)
31+ gint x,
32+ gint y)
33 {
34+ GdkRectangle rect;
35 OsScrollbarPrivate *priv;
36- gint screen_width;
37-
38+ gint screen_width, n_monitor;
39+ GdkScreen *screen;
40+
41 priv = scrollbar->priv;
42
43- /* FIXME we could store screen_width in priv
44- * and change it at screen-changed signal */
45- screen_width = gdk_screen_get_width (gtk_widget_get_screen (GTK_WIDGET (scrollbar)));
46-
47- /* FIXME we could apply a static offest we
48- * set in size-allocate and configure-event */
49+ screen = gtk_widget_get_screen (GTK_WIDGET (scrollbar));
50+ n_monitor = gdk_screen_get_monitor_at_point (screen, x, y);
51+ gdk_screen_get_monitor_geometry (screen, n_monitor, &rect);
52+
53+ screen_width = rect.x + rect.width;
54+
55 if (priv->orientation == GTK_ORIENTATION_VERTICAL &&
56- (x + priv->slider.width > screen_width))
57+ (n_monitor != gdk_screen_get_monitor_at_point (screen, x + priv->slider.width, y) ||
58+ (x + priv->slider.width) >= screen_width))
59 return x - DEFAULT_PAGER_WIDTH - priv->slider.width;
60
61 return x;
62@@ -446,21 +450,25 @@
63
64 static gint
65 os_scrollbar_sanitize_y (OsScrollbar *scrollbar,
66+ gint x,
67 gint y)
68 {
69+ GdkRectangle rect;
70 OsScrollbarPrivate *priv;
71- gint screen_height;
72-
73+ gint screen_height, n_monitor;
74+ GdkScreen *screen;
75+
76 priv = scrollbar->priv;
77
78- /* FIXME we could store screen_height in priv
79- * and change it at screen-changed signal */
80- screen_height = gdk_screen_get_height (gtk_widget_get_screen (GTK_WIDGET (scrollbar)));
81+ screen = gtk_widget_get_screen (GTK_WIDGET (scrollbar));
82+ n_monitor = gdk_screen_get_monitor_at_point (screen, x, y);
83+ gdk_screen_get_monitor_geometry (screen, n_monitor, &rect);
84+
85+ screen_height = rect.y + rect.height;
86
87- /* FIXME we could apply a static offest we
88- * set in size-allocate and configure-event */
89 if (priv->orientation == GTK_ORIENTATION_HORIZONTAL &&
90- (y + priv->slider.height > screen_height))
91+ (n_monitor != gdk_screen_get_monitor_at_point (screen, x, y + priv->slider.height) ||
92+ (y + priv->slider.height) >= screen_height))
93 return y - DEFAULT_PAGER_WIDTH - priv->slider.height;
94
95 return y;

Subscribers

People subscribed via source and target branches