~john-ledbetter/notify-osd/bug-fixing

« back to all changes in this revision

Viewing changes to tests/test-grow-bubble.c

  • Committer: Mirco Müller
  • Date: 2010-10-06 11:05:30 UTC
  • mfrom: (426.1.1 notify-osd)
  • Revision ID: mirco.mueller@ubuntu.com-20101006110530-59q89yhox49jnc7s
modified:
  configure.in
  src/bubble-window-accessible.c
  src/bubble.c
  src/defaults.c
  src/dialog.c
  tests/test-dnd.c
  tests/test-grow-bubble.c
  tests/test-scroll-text.c
  tests/test-tile.c

Merged Michael Terry's deprecations branch into trunk after review and
approval from David and myself. It makes notify-osd compile without using
any deprecated symbols and ready for GTK3. This fixes LP: #655232

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
        /* top-left, right of the corner */
66
66
        cairo_move_to (cr, x + radius, y);
67
67
 
68
 
        /* top-right, left of the corner */
 
68
        /* top-right, left of the corner */
69
69
        cairo_line_to (cr,
70
70
                       x + width - radius,
71
71
                       y);
78
78
                   -90.0f * G_PI / 180.0f,
79
79
                   0.0f * G_PI / 180.0f);
80
80
 
81
 
        /* bottom-right, above the corner */
 
81
        /* bottom-right, above the corner */
82
82
        cairo_line_to (cr,
83
83
                       x + width,
84
84
                       y + height - radius);
85
85
 
86
 
        /* bottom-right, left of the corner */
 
86
        /* bottom-right, left of the corner */
87
87
        cairo_arc (cr,
88
88
                   x + width - radius,
89
89
                   y + height - radius,
96
96
                       x + radius,
97
97
                       y + height);
98
98
 
99
 
        /* bottom-left, above the corner */
 
99
        /* bottom-left, above the corner */
100
100
        cairo_arc (cr,
101
101
                   x + radius,
102
102
                   y + height - radius,
176
176
              gint       radius,
177
177
              gint       shadow_size)
178
178
{
179
 
        GdkBitmap* mask   = NULL;
180
 
        cairo_t*   cr     = NULL;
181
 
        gdouble    width  = (gdouble) window->allocation.width;
182
 
        gdouble    height = (gdouble) window->allocation.height;
 
179
        GdkBitmap*    mask   = NULL;
 
180
        cairo_t*      cr     = NULL;
 
181
        GtkAllocation allocation;
 
182
        gdouble       width;
 
183
        gdouble       height;
 
184
 
 
185
        gtk_widget_get_allocation (window, &allocation);
 
186
        width = (gdouble) allocation.width;
 
187
        height = (gdouble) allocation.height;
183
188
 
184
189
        if (g_composited)
185
190
        {
353
358
                GdkEventExpose* event,
354
359
                gpointer        data)
355
360
{
356
 
        cairo_t* cr     = NULL;
357
 
        guint    width  = window->allocation.width;
358
 
        guint    height = window->allocation.height;
359
 
 
360
 
        cr = gdk_cairo_create (window->window);
 
361
        cairo_t*      cr     = NULL;
 
362
        GtkAllocation a;
 
363
 
 
364
        gtk_widget_get_allocation (window, &a);
 
365
 
 
366
        cr = gdk_cairo_create (gtk_widget_get_window (window));
361
367
 
362
368
        /* clear and render drop-shadow and bubble-background */
363
369
        cairo_scale (cr, 1.0f, 1.0f);
371
377
                                         cr,
372
378
                                         0.0f,
373
379
                                         0.0f,
374
 
                                         width,
375
 
                                         height,
 
380
                                         a.width,
 
381
                                         a.height,
376
382
                                         g_distance,
377
383
                                         1.0f - g_distance);
378
384
                gtk_window_set_opacity (GTK_WINDOW (window), 0.3f + g_distance * 0.7f);
383
389
                                         cr,
384
390
                                         0.0f,
385
391
                                         0.0f,
386
 
                                         width,
387
 
                                         height,
 
392
                                         a.width,
 
393
                                         a.height,
388
394
                                         g_distance,
389
395
                                         0.0f);
390
396
                gtk_window_set_opacity (GTK_WINDOW (window), 1.0f);
399
405
set_bg_blur (GtkWidget* window,
400
406
             gboolean   blur)
401
407
{
402
 
        gint width;
403
 
        gint height;
 
408
        GtkAllocation a;
 
409
        GdkWindow *gdkwindow;
404
410
        gint shadow = BUBBLE_SHADOW_SIZE;
405
411
 
406
412
        if (!window)
407
413
                return;
408
414
 
409
 
        width  = window->allocation.width;
410
 
        height = window->allocation.height;
 
415
        gtk_widget_get_allocation (window, &a);
 
416
        gdkwindow = gtk_widget_get_window (window);
411
417
 
412
418
        if (blur)
413
419
        {
414
420
                glong data[] = {
415
 
                        2,                 /* threshold               */
416
 
                        0,                 /* filter                  */
417
 
                        NorthWestGravity,  /* gravity of top-left     */
418
 
                        shadow,            /* x-coord of top-left     */
419
 
                        -height/2 + shadow,/* y-coord of top-left     */
420
 
                        NorthWestGravity,  /* gravity of bottom-right */
421
 
                        width - shadow,    /* bottom-right x-coord    */
422
 
                        height/2 - shadow  /* bottom-right y-coord    */};
 
421
                        2,                   /* threshold               */
 
422
                        0,                   /* filter                  */
 
423
                        NorthWestGravity,    /* gravity of top-left     */
 
424
                        shadow,              /* x-coord of top-left     */
 
425
                        -a.height/2 + shadow,/* y-coord of top-left     */
 
426
                        NorthWestGravity,    /* gravity of bottom-right */
 
427
                        a.width - shadow,    /* bottom-right x-coord    */
 
428
                        a.height/2 - shadow  /* bottom-right y-coord    */};
423
429
 
424
 
                XChangeProperty (GDK_WINDOW_XDISPLAY (window->window),
425
 
                                 GDK_WINDOW_XID (window->window),
426
 
                                XInternAtom(GDK_WINDOW_XDISPLAY(window->window),
 
430
                XChangeProperty (GDK_WINDOW_XDISPLAY (gdkwindow),
 
431
                                 GDK_WINDOW_XID (gdkwindow),
 
432
                                XInternAtom(GDK_WINDOW_XDISPLAY(gdkwindow),
427
433
                                              "_COMPIZ_WM_WINDOW_BLUR",
428
434
                                              FALSE),
429
435
                                 XA_INTEGER,
434
440
        }
435
441
        else
436
442
        {
437
 
                XDeleteProperty (GDK_WINDOW_XDISPLAY (window->window),
438
 
                                 GDK_WINDOW_XID (window->window),
439
 
                                XInternAtom(GDK_WINDOW_XDISPLAY(window->window),
 
443
                XDeleteProperty (GDK_WINDOW_XDISPLAY (gdkwindow),
 
444
                                 GDK_WINDOW_XID (gdkwindow),
 
445
                                XInternAtom(GDK_WINDOW_XDISPLAY(gdkwindow),
440
446
                                              "_COMPIZ_WM_WINDOW_BLUR",
441
447
                                              FALSE));
442
448
        }
529
535
 
530
536
        old_mouse_over = g_mouse_over;
531
537
 
532
 
        if (GTK_WIDGET_REALIZED (window))
 
538
        if (gtk_widget_get_realized (window))
533
539
        {
534
540
                gint distance_x = 0;
535
541
                gint distance_y = 0;
735
741
        // make sure the window opens with a RGBA-visual
736
742
        screen_changed_handler (window, NULL, NULL);
737
743
        gtk_widget_realize (window);
738
 
        gdk_window_set_back_pixmap (window->window, NULL, FALSE);
 
744
        gdk_window_set_back_pixmap (gtk_widget_get_window (window), NULL, FALSE);
739
745
 
740
746
        // hook up window-event handlers to window
741
747
        g_signal_connect (G_OBJECT (window),