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: mp+276580@code.launchpad.net

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
=== modified file 'src/defaults.c'
--- src/defaults.c 2014-12-20 19:02:42 +0000
+++ src/defaults.c 2015-11-03 18:43:29 +0000
@@ -468,6 +468,11 @@
468 G_CALLBACK (_font_changed),468 G_CALLBACK (_font_changed),
469 self);469 self);
470470
471 g_signal_connect (gtk_settings_get_default (),
472 "notify::gtk-xft-dpi",
473 G_CALLBACK (_font_changed),
474 self);
475
471 g_signal_connect (self->nosd_settings,476 g_signal_connect (self->nosd_settings,
472 "changed",477 "changed",
473 G_CALLBACK (_gravity_changed),478 G_CALLBACK (_gravity_changed),
474479
=== modified file 'src/stack.c'
--- src/stack.c 2013-11-07 15:37:20 +0000
+++ src/stack.c 2015-11-03 18:43:29 +0000
@@ -269,16 +269,22 @@
269 bubble_refresh (bubble);269 bubble_refresh (bubble);
270}270}
271271
272static Bubble *sync_bubble = NULL;
273
272static void274static void
273value_changed_handler (Defaults* defaults,275value_changed_handler (Defaults* defaults,
274 Stack* stack)276 Stack* stack)
275{277{
276 if (stack->list != NULL)278 if (stack->list != NULL)
277 g_list_foreach (stack->list, _trigger_bubble_redraw, NULL);279 g_list_foreach (stack->list, _trigger_bubble_redraw, NULL);
280
281 if (sync_bubble != NULL)
282 {
283 bubble_recalc_size (sync_bubble);
284 bubble_refresh (sync_bubble);
285 }
278}286}
279287
280static Bubble *sync_bubble = NULL;
281
282#include "display.c"288#include "display.c"
283289
284/*-- public API --------------------------------------------------------------*/290/*-- public API --------------------------------------------------------------*/

Subscribers

People subscribed via source and target branches