~larsu/notify-osd/fix-1189281

« back to all changes in this revision

Viewing changes to src/stack.c

  • Committer: Tarmac
  • Author(s): Michael Terry
  • Date: 2012-11-26 19:37:13 UTC
  • mfrom: (456.1.1 no-border)
  • Revision ID: tarmac-20121126193713-qcfs6arzuhuepwmf
When running without a compositor, there is an ugly black border.

This branch fixes that by:
1) Adding an 'is_composited' argument to defaults_get_bubble_shadow_size and defaults_get_bubble_corner_radius.  If we're not composited, they return 0.0f.
2) Adding a 'GdkScreen **screen' argument to defaults_get_top_corner
3) Using these throughout to check composited state wherever these are used.

Additionally, I had to add some oddness in bubble.c for _refresh_background.  There is a bit of code that draws a (seemingly unnecessary) image in shadow-size-units even in the uncomposited case.  But it can't use 0 because that causes a crash to create a 0-sized image.  So I used 1 for that special case.  Seems like it would be cleaner to avoid that path in uncomposited mode, but I didn't feel confident enough to make that change.

Approved by Didier Roche, jenkins.

Show diffs side-by-side

added added

removed removed

Lines of Context:
885
885
                         gint*  x,
886
886
                         gint*  y)
887
887
{
 
888
        GdkScreen* screen        = NULL;
 
889
        gboolean   is_composited = FALSE;
 
890
 
888
891
        // sanity checks
889
892
        if (!x && !y)
890
893
                return;
904
907
        }
905
908
 
906
909
        // initialize x and y
907
 
        defaults_get_top_corner (self->defaults, x, y);
 
910
        defaults_get_top_corner (self->defaults, &screen, x, y);
 
911
 
 
912
        is_composited = gdk_screen_is_composited (screen);
908
913
 
909
914
        // differentiate returned top-left corner for top and bottom slot
910
915
        // depending on the placement 
920
925
                                *y += defaults_get_desktop_height (d) / 2 -
921
926
                                      EM2PIXELS (defaults_get_bubble_vert_gap (d) / 2.0f, d) -
922
927
                                      bubble_height +
923
 
                                      EM2PIXELS (defaults_get_bubble_shadow_size (d), d);
 
928
                                      EM2PIXELS (defaults_get_bubble_shadow_size (d, is_composited), d);
924
929
                        // the position for the async. bubble
925
930
                        else if (slot == SLOT_BOTTOM)
926
931
                                *y += defaults_get_desktop_height (d) / 2 +
927
932
                                      EM2PIXELS (defaults_get_bubble_vert_gap (d) / 2.0f, d) -
928
 
                                      EM2PIXELS (defaults_get_bubble_shadow_size (d), d);
 
933
                                      EM2PIXELS (defaults_get_bubble_shadow_size (d, is_composited), d);
929
934
                break;
930
935
 
931
936
                case GRAVITY_NORTH_EAST:
945
950
                                                *y += EM2PIXELS (defaults_get_icon_size (d), d) +
946
951
                                                      2 * EM2PIXELS (defaults_get_margin_size (d), d) +
947
952
                                                      EM2PIXELS (defaults_get_bubble_vert_gap (d), d); /* +
948
 
                                                      2 * EM2PIXELS (defaults_get_bubble_shadow_size (d), d);*/
 
953
                                                      2 * EM2PIXELS (defaults_get_bubble_shadow_size (d, is_composited), d);*/
949
954
                                        break;
950
955
 
951
956
                                        case SLOT_ALLOCATION_DYNAMIC:
952
957
                                                g_assert (stack_is_slot_vacant (self, SLOT_TOP) == OCCUPIED);
953
958
                                                *y += bubble_get_height (self->slots[SLOT_TOP]) +
954
959
                                                      EM2PIXELS (defaults_get_bubble_vert_gap (d), d) -
955
 
                                                      2 * EM2PIXELS (defaults_get_bubble_shadow_size (d), d);
 
960
                                                      2 * EM2PIXELS (defaults_get_bubble_shadow_size (d, is_composited), d);
956
961
                                        break;
957
962
 
958
963
                                        default: