Merge lp:~macslow/notify-osd/notify-osd.fix-716458 into lp:~canonical-dx-team/notify-osd/precise

Proposed by Mirco Müller
Status: Merged
Approved by: Gord Allott
Approved revision: 458
Merged at revision: 455
Proposed branch: lp:~macslow/notify-osd/notify-osd.fix-716458
Merge into: lp:~canonical-dx-team/notify-osd/precise
Diff against target: 96 lines (+73/-1)
2 files modified
manual-tests/avoid-position-in-invisible-area.txt (+28/-0)
src/defaults.c (+45/-1)
To merge this branch: bzr merge lp:~macslow/notify-osd/notify-osd.fix-716458
Reviewer Review Type Date Requested Status
Gord Allott (community) Approve
Canonical Desktop Experience Team Pending
Review via email: mp+98989@code.launchpad.net

Description of the change

This fixes the problem with notifications "hiding" in invisible areas of multi-monitor setups when the vertical resolutions of the attached screens differs and they are bottom-edge aligned and users go with the default setting for multimonitor-mode and gravity.

Complete with a manual-test for the QA.

To post a comment you must log in.
458. By Mirco Müller

Updated and fixed manual-test for LP: #716458 bugfix

Revision history for this message
Gord Allott (gordallott) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'manual-tests/avoid-position-in-invisible-area.txt'
2--- manual-tests/avoid-position-in-invisible-area.txt 1970-01-01 00:00:00 +0000
3+++ manual-tests/avoid-position-in-invisible-area.txt 2012-03-23 11:17:18 +0000
4@@ -0,0 +1,28 @@
5+1.) Have a two-monitor setup and configure the displays in such a way that the
6+vertical resolution between the two monitors differs by at least 100 pixels.
7+Align the displays at the bottom edge! Make the monitor with the lower vertical
8+resolution the primary display.
9+
10+Depending on your GPU/driver combination, you can use the GNOME display-settings
11+for setting this up or you have to use a tool like nvidia-settings.
12+
13+2.) Kill and restart notify-osd by doing...
14+
15+ killall -15 notify-osd
16+ /usr/lib/notify-osd/notify-osd
17+
18+2.) Set focus-follow off and gravity to 1 with...
19+
20+ gsettings set com.canonical.notify-osd multihead-mode "dont-focus-follow"
21+ gsettings set com.canonical.notify-osd gravity 1
22+
23+4.) Trigger two notifications (a synchronous one and a regular one) with these
24+commands...
25+
26+ notify-send "Test bubble" "A regular notification used for testing." -i info
27+ notify-send " " " " -i info -h string:"x-canonical-private-icon-only":1 -h string:"x-canonical-private-synchronous":1 -i info
28+
29+5.) You should now see both notifications fully at the visible top-right corner
30+of the whole screen area.
31+
32+6.) For RTL-locales you have to flip 1.) - 5.) side-ways of course.
33
34=== modified file 'src/defaults.c'
35--- src/defaults.c 2012-03-09 21:21:20 +0000
36+++ src/defaults.c 2012-03-23 11:17:18 +0000
37@@ -2223,7 +2223,7 @@
38 g_return_if_fail (self != NULL && IS_DEFAULTS (self));
39
40 gdk_display_get_pointer (gdk_display_get_default (),
41- &screen,
42+ &screen,
43 &mx,
44 &my,
45 NULL);
46@@ -2301,6 +2301,50 @@
47 *y += EM2PIXELS (defaults_get_bubble_vert_gap (self), self)
48 - EM2PIXELS (defaults_get_bubble_shadow_size (self), self);
49
50+ /* correct potential offset in multi-monitor setups with two (or more)
51+ * monitors side by side, all having different vertical resolutions and
52+ * being aligned at the bottom edge, thus creating an "invisible" area at
53+ * the top edge of the monitor with the lowest vertical resolution,
54+ * LP: #716458 */
55+ GdkRectangle cur_geo = {0, 0, 0, 0};
56+ int num_monitors = gdk_screen_get_n_monitors (screen);
57+ int screen_width = gdk_screen_get_width (screen);
58+ int screen_height = gdk_screen_get_height (screen);
59+
60+ if (!follow_focus && num_monitors > 1)
61+ {
62+ int vert_offset = 0;
63+
64+ if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_LTR)
65+ {
66+ int right_most_monitor = 0;
67+
68+ right_most_monitor = gdk_screen_get_monitor_at_point (screen,
69+ screen_width,
70+ screen_height / 2);
71+ gdk_screen_get_monitor_geometry (screen,
72+ right_most_monitor,
73+ &cur_geo);
74+ if (cur_geo.y != 0)
75+ vert_offset = cur_geo.y;
76+ }
77+ else
78+ {
79+ int left_most_monitor = 0;
80+
81+ left_most_monitor = gdk_screen_get_monitor_at_point (screen,
82+ 0,
83+ screen_height / 2);
84+ gdk_screen_get_monitor_geometry (screen,
85+ left_most_monitor,
86+ &cur_geo);
87+ if (cur_geo.y != 0)
88+ vert_offset = cur_geo.y;
89+ }
90+
91+ *y += vert_offset;
92+ }
93+
94 if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_LTR)
95 {
96 *x = rect.x + rect.width;

Subscribers

People subscribed via source and target branches