~cairo-dock-team/ubuntu/natty/cairo-dock/2.3.0-1

« back to all changes in this revision

Viewing changes to src/gldit/cairo-dock-container.c

  • Committer: matttbe
  • Date: 2010-09-07 00:38:36 UTC
  • Revision ID: matttbe@gmail.com-20100907003836-zcu32v4gr61k850z
* New Upstream Version (LP: #632055)
* Fixed a few bugs on LP:
 - LP: #618336 all button tips visible if icons 'maximum zoom' set to 1.0
 - LP: #614686 create new sud-dock icon that looking like flat
 - LP: #612617 Add custom launchers or sub-docks, can't modify name.
 - LP: #612355 Add option in config file to set GL/Cairo mode            
 - LP: #611733 icon labels go off-screen
* Fixed a crash when changing theme or gauges
* Updated translations
* New Upstream Version (LP: #614624)
* Fixed a few bugs on LP:
 - LP: #518453: Dock appears under all windows
                 (Compiz - fullscreen window)
 - LP: #521369: Separator are not removed when closing
                 grouped windows
 - LP: #521762: Some sentences are not correct
 - LP: #526466: Icons of apps with same class shouldn't
                 be stacked by default
 - LP: #535083: Dialogues looks ugly when a lot of them
                 appears at the same time
 - More details on the 'ChangeLog' file
* debian/rules:
 - Autotools has been replaced by CMake
 - Man pages are now included in the source code
* debian/copyright:
 - Updated with the new pathes and new files
* debian/control:
 - Autotools has been replaced by CMake
 - Added libcurl4-gnutls-dev as Build-deps
 - Bump Standard-Version to 3.9.1
* debian/cairo-dock-core.install:
 - Man pages are now included in the source code
 - All sonames are now installed into lib32 or lib64
* debian/cairo-dock-dev.install:
 - pkgconfig is now installed into lib32 or lib64

Show diffs side-by-side

added added

removed removed

Lines of Context:
100
100
        }
101
101
        if (g_pPrimaryContainer == pContainer)
102
102
                g_pPrimaryContainer = NULL;
 
103
        else
 
104
                cairo_dock_set_default_gl_context ();
103
105
}
104
106
 
105
107
void cairo_dock_set_colormap_for_window (GtkWidget *pWidget)
398
400
                NULL,
399
401
                pDock);*/
400
402
}
401
 
void cairo_dock_popup_menu_on_container (GtkWidget *menu, CairoContainer *pContainer)
402
 
{
 
403
static void _place_menu_on_icon (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer *data)
 
404
{
 
405
        *push_in = TRUE;
 
406
        Icon *pIcon = data[0];
 
407
        CairoContainer *pContainer = data[1];
 
408
        int x0 = pContainer->iWindowPositionX + pIcon->fDrawX;
 
409
        int y0 = pContainer->iWindowPositionY + pIcon->fDrawY;
 
410
        
 
411
        int w, h;  // taille menu
 
412
        GtkRequisition requisition;
 
413
        gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
 
414
        w = requisition.width;
 
415
        h = requisition.height;
 
416
        
 
417
        //g_print ("%d;%d %dx%d\n", x0, y0, w, h);
 
418
        if (pContainer->bIsHorizontal)
 
419
        {
 
420
                *x = x0;
 
421
                if (pContainer->bDirectionUp)
 
422
                        *y = y0 - h;  /// - h_menu ?...
 
423
                else
 
424
                        *y = y0 + pIcon->fHeight * pIcon->fScale;
 
425
        }
 
426
        else
 
427
        {
 
428
                *y = x0;
 
429
                if (pContainer->bDirectionUp)
 
430
                        *x = y0 - w;  /// - w_menu ?...
 
431
                else
 
432
                        *x = y0 + pIcon->fHeight * pIcon->fScale;
 
433
        }
 
434
}
 
435
void cairo_dock_popup_menu_on_icon (GtkWidget *menu, Icon *pIcon, CairoContainer *pContainer)
 
436
{
 
437
        static gpointer *data = NULL;  // 1 seul menu a la fois, donc on peut la faire statique.
 
438
        
403
439
        if (menu == NULL)
404
440
                return;
 
441
        GtkMenuPositionFunc place_menu = NULL;
 
442
        if (pIcon != NULL && pContainer != NULL)
 
443
        {
 
444
                place_menu = (GtkMenuPositionFunc)_place_menu_on_icon;
 
445
                if (data == NULL)
 
446
                        data = g_new0 (gpointer, 2);
 
447
                data[0] = pIcon;
 
448
                data[1] = pContainer;
 
449
        }
 
450
        
405
451
        if (CAIRO_DOCK_IS_DOCK (pContainer))
406
452
        {
407
453
                if (g_signal_handler_find (menu,
410
456
                        0,
411
457
                        NULL,
412
458
                        _cairo_dock_delete_menu,
413
 
                        pContainer) == 0)  // on evite de connecter 2 fois ce signal, donc la fonction est appelable plusieurs fois.
 
459
                        pContainer) == 0)  // on evite de connecter 2 fois ce signal, donc la fonction est appelable plusieurs fois sur un meme menu.
414
460
                {
415
461
                        g_signal_connect (G_OBJECT (menu),
416
462
                                "deactivate",
421
467
        }
422
468
        
423
469
        gtk_widget_show_all (GTK_WIDGET (menu));
424
 
 
 
470
        
425
471
        gtk_menu_popup (GTK_MENU (menu),
426
472
                NULL,
427
473
                NULL,
428
 
                NULL,
429
 
                NULL,
 
474
                place_menu,
 
475
                data,
430
476
                1,
431
477
                gtk_get_current_event_time ());
432
478
}
457
503
}
458
504
 
459
505
 
 
506
static GtkWidget *s_pMenu = NULL;
 
507
static gboolean _on_delete_menu (GtkWidget *widget, GdkEvent  *event, gpointer   user_data)
 
508
{
 
509
        g_print ("*** menu deleted\n");
 
510
        s_pMenu = NULL;
 
511
        return FALSE;
 
512
}
460
513
GtkWidget *cairo_dock_build_menu (Icon *icon, CairoContainer *pContainer)
461
514
{
462
 
        static GtkWidget *s_pMenu = NULL;
463
515
        if (s_pMenu != NULL)
464
516
        {
465
517
                gtk_widget_destroy (GTK_WIDGET (s_pMenu));
480
532
        }
481
533
        
482
534
        cairo_dock_notify (CAIRO_DOCK_BUILD_ICON_MENU, icon, pContainer, menu);
 
535
        g_signal_connect (G_OBJECT (menu), "delete-event", G_CALLBACK (_on_delete_menu), NULL);  // apparemment inutile.
 
536
        
483
537
        s_pMenu = menu;
484
538
        return menu;
485
539
}