~unity-team/unity-window-decorator/uwd.hack

« back to all changes in this revision

Viewing changes to src/decorator.c

  • Committer: Sam Spilsbury
  • Date: 2010-12-09 16:45:02 UTC
  • Revision ID: git-v1:33f287138c730f81be99e41fbcd54fdc46992f76
Add the ability for themes to specify active/inactive shadows, right now shadow values
are hardcoded

Show diffs side-by-side

added added

removed removed

Lines of Context:
319
319
    }
320
320
}
321
321
 
322
 
 
323
 
 
324
322
gboolean
325
323
update_window_decoration_size (WnckWindow *win)
326
324
{
409
407
    return TRUE;
410
408
}
411
409
 
412
 
/* to save some memory, value is specific to current decorations */
413
 
#define TRANSLUCENT_CORNER_SIZE 3
414
 
 
415
 
static void
 
410
void
416
411
draw_border_shape (Display         *xdisplay,
417
412
                   Pixmap          pixmap,
418
413
                   Picture         picture,
483
478
    opt_active_shadow.shadow_offset_x = shadow_offset_x;
484
479
    opt_active_shadow.shadow_offset_y = shadow_offset_y;
485
480
 
 
481
    opt_inactive_shadow.shadow_radius  = shadow_radius;
 
482
    opt_inactive_shadow.shadow_opacity = shadow_opacity;
 
483
 
 
484
    memcpy (opt_inactive_shadow.shadow_color, shadow_color, sizeof (shadow_color));
 
485
 
 
486
    opt_inactive_shadow.shadow_offset_x = shadow_offset_x;
 
487
    opt_inactive_shadow.shadow_offset_y = shadow_offset_y;
 
488
 
486
489
    opt_no_shadow.shadow_radius  = 0;
487
490
    opt_no_shadow.shadow_opacity = 0;
488
491
 
489
492
    opt_no_shadow.shadow_offset_x = 0;
490
493
    opt_no_shadow.shadow_offset_y = 0;
491
494
 
492
 
    opt_inactive_shadow.shadow_radius  = 8.0;
493
 
    opt_inactive_shadow.shadow_opacity = 0.5;
494
 
 
495
 
    opt_inactive_shadow.shadow_offset_x = 0;
496
 
    opt_inactive_shadow.shadow_offset_y = 0;
497
 
 
498
 
    memcpy (opt_inactive_shadow.shadow_color, shadow_color, sizeof (shadow_color));
499
 
 
500
495
    if (no_border_shadow)
501
496
    {
502
497
        decor_shadow_destroy (xdisplay, no_border_shadow);
511
506
                                            0,
512
507
                                            0,
513
508
                                            0, 0, 0, 0,
514
 
                                            &opt_active_shadow,
 
509
                                            &opt_inactive_shadow,
515
510
                                            &shadow_context,
516
511
                                            decor_draw_simple,
517
512
                                            0);
522
517
        border_active_shadow = NULL;
523
518
    }
524
519
 
525
 
    border_active_shadow = decor_shadow_create (xdisplay,
526
 
                                         gdk_x11_screen_get_xscreen (screen),
527
 
                                         1, 1,
528
 
                                         _win_extents.left,
529
 
                                         _win_extents.right,
530
 
                                         _win_extents.top + titlebar_height,
531
 
                                         _win_extents.bottom,
532
 
                                         _win_extents.left -
533
 
                                         TRANSLUCENT_CORNER_SIZE,
534
 
                                         _win_extents.right -
535
 
                                         TRANSLUCENT_CORNER_SIZE,
536
 
                                         _win_extents.top + titlebar_height -
537
 
                                         TRANSLUCENT_CORNER_SIZE,
538
 
                                         _win_extents.bottom -
539
 
                                         TRANSLUCENT_CORNER_SIZE,
540
 
                                         &opt_active_shadow,
541
 
                                         &window_active_context,
542
 
                                         draw_border_shape,
543
 
                                         0);
 
520
    border_active_shadow = (*theme_update_shadow) (SHADOW_TYPE_ACTIVE_NORMAL);
544
521
 
545
522
    if (border_inactive_shadow)
546
523
    {
548
525
        border_inactive_shadow = NULL;
549
526
    }
550
527
 
551
 
    border_inactive_shadow = decor_shadow_create (xdisplay,
552
 
                                         gdk_x11_screen_get_xscreen (screen),
553
 
                                         1, 1,
554
 
                                         _win_extents.left,
555
 
                                         _win_extents.right,
556
 
                                         _win_extents.top + titlebar_height,
557
 
                                         _win_extents.bottom,
558
 
                                         _win_extents.left -
559
 
                                         TRANSLUCENT_CORNER_SIZE,
560
 
                                         _win_extents.right -
561
 
                                         TRANSLUCENT_CORNER_SIZE,
562
 
                                         _win_extents.top + titlebar_height -
563
 
                                         TRANSLUCENT_CORNER_SIZE,
564
 
                                         _win_extents.bottom -
565
 
                                         TRANSLUCENT_CORNER_SIZE,
566
 
                                         &opt_inactive_shadow,
567
 
                                         &window_inactive_context,
568
 
                                         draw_border_shape,
569
 
                                         0);
 
528
    border_inactive_shadow = (*theme_update_shadow) (SHADOW_TYPE_INACTIVE_NORMAL);
570
529
 
571
530
    if (border_no_shadow)
572
531
    {
594
553
                                         draw_border_shape,
595
554
                                         0);
596
555
 
 
556
    decor_context_t *context = &window_context_no_shadow;
 
557
 
597
558
 
598
559
    if (max_border_active_shadow)
599
560
    {
601
562
        max_border_active_shadow = NULL;
602
563
    }
603
564
 
604
 
    max_border_active_shadow =
605
 
        decor_shadow_create (xdisplay,
606
 
                             gdk_x11_screen_get_xscreen (screen),
607
 
                             1, 1,
608
 
                             _max_win_extents.left,
609
 
                             _max_win_extents.right,
610
 
                             _max_win_extents.top + max_titlebar_height,
611
 
                             _max_win_extents.bottom,
612
 
                             _max_win_extents.left - TRANSLUCENT_CORNER_SIZE,
613
 
                             _max_win_extents.right - TRANSLUCENT_CORNER_SIZE,
614
 
                             _max_win_extents.top + max_titlebar_height -
615
 
                             TRANSLUCENT_CORNER_SIZE,
616
 
                             _max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
617
 
                             &opt_active_shadow,
618
 
                             &max_window_active_context,
619
 
                             draw_border_shape,
620
 
                             (void *) 1);
 
565
    max_border_active_shadow = (*theme_update_shadow) (SHADOW_TYPE_ACTIVE_MAX);
621
566
 
622
567
    if (max_border_inactive_shadow)
623
568
    {
625
570
        max_border_inactive_shadow = NULL;
626
571
    }
627
572
 
628
 
    max_border_inactive_shadow =
629
 
        decor_shadow_create (xdisplay,
630
 
                             gdk_x11_screen_get_xscreen (screen),
631
 
                             1, 1,
632
 
                             _max_win_extents.left,
633
 
                             _max_win_extents.right,
634
 
                             _max_win_extents.top + max_titlebar_height,
635
 
                             _max_win_extents.bottom,
636
 
                             _max_win_extents.left - TRANSLUCENT_CORNER_SIZE,
637
 
                             _max_win_extents.right - TRANSLUCENT_CORNER_SIZE,
638
 
                             _max_win_extents.top + max_titlebar_height -
639
 
                             TRANSLUCENT_CORNER_SIZE,
640
 
                             _max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
641
 
                             &opt_inactive_shadow,
642
 
                             &max_window_inactive_context,
643
 
                             draw_border_shape,
644
 
                             (void *) 1);
 
573
    max_border_inactive_shadow = (*theme_update_shadow) (SHADOW_TYPE_INACTIVE_MAX);
645
574
 
646
575
    if (max_border_no_shadow)
647
576
    {
688
617
                                           TRANSLUCENT_CORNER_SIZE,
689
618
                                           _switcher_extents.bottom -
690
619
                                           TRANSLUCENT_CORNER_SIZE,
691
 
                                           &opt_active_shadow,
 
620
                                           &opt_inactive_shadow,
692
621
                                           &switcher_context,
693
622
                                           decor_draw_simple,
694
623
                                           0);