~ubuntu-branches/ubuntu/oneiric/gnome-panel/oneiric

« back to all changes in this revision

Viewing changes to gnome-panel/nothing.cP

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-03-30 11:59:32 UTC
  • mfrom: (1.13.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20100330115932-j94o334zoki5sbkb
Tags: 1:2.30.0-0ubuntu1
* New upstream version
* debian/patches/25_dynamic_fusa_detection.patch:
  - update by Cody Russell to try to fix a crasher in the change
    (lp: #448084)
* debian/patches/70_relibtoolize.patch: 
  - new version update

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
static int
75
75
goat_timeout_func(gpointer data)
76
76
{
 
77
        GtkAllocation allocation;
77
78
        cairo_t *cr;
78
79
        int real_goat_frame;
79
80
        gboolean sound = FALSE;
89
90
                return FALSE;
90
91
        }
91
92
        
92
 
        cr = gdk_cairo_create (goat_darea->window);
 
93
        gtk_widget_get_allocation (goat_darea, &allocation);
 
94
        cr = gdk_cairo_create (gtk_widget_get_window (goat_darea));
93
95
 
94
96
        if(goat_x == -1) {
95
97
                cairo_set_source_rgb (cr, 1, 1, 1);
107
109
        goat_y += goat_accy;
108
110
 
109
111
 
110
 
        if(goat_x>goat_darea->allocation.width-2-goat_width) {
 
112
        if(goat_x>allocation.width-2-goat_width) {
111
113
                goat_accx = -(g_random_int()%4 +3);
112
 
                goat_x = goat_darea->allocation.width-2-goat_width;
 
114
                goat_x = allocation.width-2-goat_width;
113
115
                sound = TRUE;
114
116
        } else if(goat_x<2) {
115
117
                goat_accx = g_random_int()%4 +3;
116
118
                goat_x = 2;
117
119
                sound = TRUE;
118
120
        }
119
 
        if(goat_y>goat_darea->allocation.height-2-goat_height) {
 
121
        if(goat_y>allocation.height-2-goat_height) {
120
122
                goat_accy = -(g_random_int()%4 +3);
121
 
                goat_y = goat_darea->allocation.height-2-goat_height;
 
123
                goat_y = allocation.height-2-goat_height;
122
124
                sound = TRUE;
123
125
        } else if(goat_y<2) {
124
126
                goat_accy = g_random_int()%4 +3;
170
172
        if(!gtk_widget_is_drawable(widget))
171
173
                return FALSE;
172
174
 
173
 
        cr = gdk_cairo_create (goat_darea->window);
 
175
        cr = gdk_cairo_create (gtk_widget_get_window (goat_darea));
174
176
 
175
177
        cairo_set_source_rgb (cr, 1, 1, 1);
176
178
        cairo_paint (cr);
183
185
static void
184
186
goat_realize(GtkWidget *widget)
185
187
{
 
188
        GdkWindow *window;
186
189
        int frame;
187
190
        char *files[] = {
188
191
                "gnome-gegl2.png",
190
193
        };
191
194
        if(goat_pix[0])
192
195
                return;
 
196
        window = gtk_widget_get_window (widget);
193
197
        for(frame=0;frame<2;frame++) {
194
198
                GdkPixbuf *pb;
195
199
                char      *file;
213
217
                width = gdk_pixbuf_get_width(pb);
214
218
                height = gdk_pixbuf_get_height(pb);
215
219
 
216
 
                goat_pix[frame] = gdk_pixmap_new(widget->window,
 
220
                goat_pix[frame] = gdk_pixmap_new(window,
217
221
                                                 width, height, -1);
218
222
                cr = gdk_cairo_create (goat_pix[frame]);
219
223
                gdk_cairo_set_source_pixbuf (cr, pb, 0, 0);
220
224
                cairo_paint (cr);
221
225
                cairo_destroy (cr);
222
226
 
223
 
                goat_pix_rev[frame] = gdk_pixmap_new(widget->window,
 
227
                goat_pix_rev[frame] = gdk_pixmap_new(window,
224
228
                                                     width, height, -1);
225
229
                cr = gdk_cairo_create (goat_pix_rev[frame]);
226
230
                gdk_cairo_set_source_pixbuf (cr, pb, 0, 0);
645
649
static gboolean
646
650
inv_draw (gpointer data)
647
651
{
 
652
        GtkStyle *style;
648
653
        GdkPixmap *goat;
649
654
        GSList *li;
650
655
        int i, j;
658
663
            geginv_pixmap == NULL)
659
664
                return TRUE;
660
665
 
 
666
        style = gtk_widget_get_style (geginv_canvas);
 
667
 
661
668
        gdk_draw_rectangle (geginv_pixmap,
662
 
                            geginv_canvas->style->white_gc,
 
669
                            style->white_gc,
663
670
                            TRUE /* filled */,
664
671
                            0, 0,
665
672
                            inv_width, inv_height);
679
686
                        y = invs[i][j].y*inv_factor - inv_goat_height/2,
680
687
 
681
688
                        gdk_draw_drawable (geginv_pixmap,
682
 
                                           geginv_canvas->style->white_gc,
 
689
                                           style->white_gc,
683
690
                                           goat,
684
691
                                           0, 0,
685
692
                                           x, y,
692
699
                InvShot *shot = li->data;
693
700
 
694
701
                gdk_draw_rectangle (geginv_pixmap,
695
 
                                    geginv_canvas->style->black_gc,
 
702
                                    style->black_gc,
696
703
                                    TRUE /* filled */,
697
704
                                    (shot->x-1)*inv_factor,
698
705
                                    (shot->y-4)*inv_factor,
711
718
                        mask = inv_phsh2_mask;
712
719
                }
713
720
 
714
 
                gdk_gc_set_clip_origin (geginv_canvas->style->white_gc,
 
721
                gdk_gc_set_clip_origin (style->white_gc,
715
722
                                        inv_our_x*inv_factor - inv_phsh_width/2,
716
723
                                        550*inv_factor - inv_phsh_height/2);
717
724
 
718
 
                gdk_gc_set_clip_mask (geginv_canvas->style->white_gc,
 
725
                gdk_gc_set_clip_mask (style->white_gc,
719
726
                                      mask);
720
727
 
721
728
                gdk_draw_drawable (geginv_pixmap,
722
 
                                   geginv_canvas->style->white_gc,
 
729
                                   style->white_gc,
723
730
                                   phsh,
724
731
                                   0, 0,
725
732
                                   inv_our_x*inv_factor - inv_phsh_width/2,
727
734
                                   inv_phsh_width,
728
735
                                   inv_phsh_height);
729
736
 
730
 
                gdk_gc_set_clip_origin (geginv_canvas->style->white_gc, 0, 0);
 
737
                gdk_gc_set_clip_origin (style->white_gc, 0, 0);
731
738
 
732
 
                gdk_gc_set_clip_mask (geginv_canvas->style->white_gc, NULL);
 
739
                gdk_gc_set_clip_mask (style->white_gc, NULL);
733
740
        }
734
741
 
735
 
        gdk_draw_drawable (geginv_canvas->window,
736
 
                           geginv_canvas->style->white_gc,
 
742
        gdk_draw_drawable (gtk_widget_get_window (geginv_canvas),
 
743
                           style->white_gc,
737
744
                           geginv_pixmap,
738
745
                           0, 0,
739
746
                           0, 0,
760
767
static void
761
768
inv_draw_explosion (int x, int y)
762
769
{
 
770
        GdkWindow *window;
 
771
        GtkStyle *style;
763
772
        int i;
764
773
        GdkColormap *cmap;
765
774
        GdkColor red;
768
777
        if ( ! gtk_widget_is_drawable (geginv_canvas))
769
778
                return;
770
779
 
771
 
        cmap = gdk_drawable_get_colormap (geginv_canvas->window);
 
780
        window = gtk_widget_get_window (geginv_canvas);
 
781
        style = gtk_widget_get_style (geginv_canvas);
 
782
 
 
783
        cmap = gdk_drawable_get_colormap (window);
772
784
        gdk_color_parse ("red", &red);
773
785
        gdk_colormap_alloc_color (cmap, &red, FALSE, TRUE);
774
786
 
775
 
        gc = gdk_gc_new (geginv_canvas->window);
 
787
        gc = gdk_gc_new (window);
776
788
        gdk_gc_set_foreground (gc, &red);
777
789
        gdk_gc_set_background (gc, &red);
778
790
 
779
791
        for (i = 5; i < 100; i += 5) {
780
 
                gdk_draw_arc (geginv_canvas->window,
 
792
                gdk_draw_arc (window,
781
793
                              gc,
782
794
                              TRUE /* filled */,
783
795
                              x-i, y-i,
790
802
        g_object_unref (G_OBJECT (gc));
791
803
 
792
804
        for (i = 5; i < 100; i += 5) {
793
 
                gdk_draw_arc (geginv_canvas->window,
794
 
                              geginv_canvas->style->white_gc,
 
805
                gdk_draw_arc (window,
 
806
                              style->white_gc,
795
807
                              TRUE /* filled */,
796
808
                              x-i, y-i,
797
809
                              i*2, i*2,
1315
1327
geginv_realized (GtkWidget *w, gpointer data)
1316
1328
{
1317
1329
        if (geginv_pixmap == NULL)
1318
 
                geginv_pixmap = gdk_pixmap_new (w->window,
 
1330
                geginv_pixmap = gdk_pixmap_new (gtk_widget_get_window (w),
1319
1331
                                                inv_width, inv_height,
1320
1332
                                                gtk_widget_get_visual (w)->depth);
1321
1333
}
1441
1453
{
1442
1454
        int x, y, sx, sy, wx, wy, foox, fooy;
1443
1455
        GtkWidget *win = data;
 
1456
        GtkAllocation allocation;
1444
1457
 
1445
1458
        data = g_object_get_data (G_OBJECT (win), "move_speed_x");
1446
1459
        sx = GPOINTER_TO_INT (data);
1447
1460
        data = g_object_get_data (G_OBJECT (win), "move_speed_y");
1448
1461
        sy = GPOINTER_TO_INT (data);
1449
1462
 
 
1463
        gtk_widget_get_allocation (win, &allocation);
 
1464
 
1450
1465
        gdk_window_get_pointer (NULL, &x, &y, NULL);
1451
 
        wx = win->allocation.x;
1452
 
        wy = win->allocation.y;
 
1466
        wx = allocation.x;
 
1467
        wy = allocation.y;
1453
1468
 
1454
 
        foox = wx + (win->allocation.width / 2);
1455
 
        fooy = wy + (win->allocation.height / 2);
 
1469
        foox = wx + (allocation.width / 2);
 
1470
        fooy = wy + (allocation.height / 2);
1456
1471
 
1457
1472
        if (sqrt ((foox - x)*(foox - x) + (fooy - y)*(fooy - y)) <
1458
 
            MAX (win->allocation.width, win->allocation.height)) {
 
1473
            MAX (allocation.width, allocation.height)) {
1459
1474
                if (foox < x) sx -= 5;
1460
1475
                else sx += 5;
1461
1476
                if (fooy < y) sy -= 5;
1475
1490
 
1476
1491
        if (wx < 0) wx = 0;
1477
1492
        if (wy < 0) wy = 0;
1478
 
        if (wx + win->allocation.width > gdk_screen_width ())
1479
 
                wx = gdk_screen_width () - win->allocation.width;
1480
 
        if (wy + win->allocation.height > gdk_screen_height ())
1481
 
                wy = gdk_screen_height () - win->allocation.height;
 
1493
        if (wx + allocation.width > gdk_screen_width ())
 
1494
                wx = gdk_screen_width () - allocation.width;
 
1495
        if (wy + allocation.height > gdk_screen_height ())
 
1496
                wy = gdk_screen_height () - allocation.height;
1482
1497
 
1483
1498
        gtk_window_move (GTK_WINDOW (win), wx, wy);
1484
 
        win->allocation.x = wx;
1485
 
        win->allocation.y = wy;
 
1499
        allocation.x = wx;
 
1500
        allocation.y = wy;
 
1501
        gtk_widget_set_allocation (win, &allocation);
1486
1502
 
1487
1503
        data = GINT_TO_POINTER (sx);
1488
1504
        g_object_set_data (G_OBJECT (win), "move_speed_x", data);