Merge lp:~larsu/notify-osd/lp1303796 into lp:notify-osd

Proposed by Lars Karlitski
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 497
Merged at revision: 498
Proposed branch: lp:~larsu/notify-osd/lp1303796
Merge into: lp:notify-osd
Diff against target: 44 lines (+13/-2)
2 files modified
src/defaults.c (+5/-0)
src/stack.c (+8/-2)
To merge this branch: bzr merge lp:~larsu/notify-osd/lp1303796
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
Review via email:

Commit message

Listen to xsettings dpi changes

We only listened to font scale factor changes on gsettings, but retrieved the actual value from xsettings (through gtk-xft-dpi). This is racy: unity-settings-daemon also listens to gsettings and might not have set the xsettings value when our handler is run.

Fix this by listening to xsettings changes as well.

This means that we're now listening for both xsettings and gsettings changes for what is essentially the same thing and recalculate size on each of them. This creates some unnecessary work, but those settings are not changed very often. We can't only listen on xsettings, because there are other gsettings keys that might trigger a change in notification bubble appearance.

Description of the change

Listen to xsettings font size changes in addition to the gsettings ones.

We still don't update the position and size of the bubble itself when a notification bubble is shown while the font settings are changed. This is ugly, but fixing it would require quite a bit of a refactor that might not be worth it.

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

looks good, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/defaults.c'
2--- src/defaults.c 2014-12-20 19:02:42 +0000
3+++ src/defaults.c 2015-11-03 18:43:29 +0000
4@@ -468,6 +468,11 @@
5 G_CALLBACK (_font_changed),
6 self);
8+ g_signal_connect (gtk_settings_get_default (),
9+ "notify::gtk-xft-dpi",
10+ G_CALLBACK (_font_changed),
11+ self);
13 g_signal_connect (self->nosd_settings,
14 "changed",
15 G_CALLBACK (_gravity_changed),
17=== modified file 'src/stack.c'
18--- src/stack.c 2013-11-07 15:37:20 +0000
19+++ src/stack.c 2015-11-03 18:43:29 +0000
20@@ -269,16 +269,22 @@
21 bubble_refresh (bubble);
22 }
24+static Bubble *sync_bubble = NULL;
26 static void
27 value_changed_handler (Defaults* defaults,
28 Stack* stack)
29 {
30 if (stack->list != NULL)
31 g_list_foreach (stack->list, _trigger_bubble_redraw, NULL);
33+ if (sync_bubble != NULL)
34+ {
35+ bubble_recalc_size (sync_bubble);
36+ bubble_refresh (sync_bubble);
37+ }
38 }
40-static Bubble *sync_bubble = NULL;
42 #include "display.c"
44 /*-- public API --------------------------------------------------------------*/


People subscribed via source and target branches