Ejemplo n.º 1
0
 public static void SetWinOpacity(Gtk.Window win, double opacity)
 {
     CompositeUtils.ChangeProperty(win.GdkWindow,
                                   Atom.Intern("_NET_WM_WINDOW_OPACITY", false),
                                   Atom.Intern("CARDINAL", false),
                                   PropMode.Replace,
                                   new uint [] { (uint)(0xffffffff * opacity) });
 }
Ejemplo n.º 2
0
 public WindowOpacityFader(Gtk.Window win, double target, double msec)
 {
     this.win      = win;
     win.Mapped   += HandleMapped;
     win.Unmapped += HandleUnmapped;
     fadin         = new DoubleAnimation(0.0, target, TimeSpan.FromMilliseconds(msec), opacity => {
         CompositeUtils.SetWinOpacity(win, opacity);
     });
 }
Ejemplo n.º 3
0
        public void HandleMapped(object sender, EventArgs args)
        {
            bool composited = CompositeUtils.SupportsHint(win.Screen, "_NET_WM_WINDOW_OPACITY");

            if (!composited)
            {
                return;
            }

            CompositeUtils.SetWinOpacity(win, 0.0);
            fadin.Start();
        }
Ejemplo n.º 4
0
        public static bool IsComposited(Screen screen)
        {
            bool composited;

            try {
                composited = gdk_screen_is_composited(screen.Handle);
            } catch (EntryPointNotFoundException) {
                Log.Debug("query composite manager locally");
                Atom atom = Atom.Intern(String.Format("_NET_WM_CM_S{0}", screen.Number), false);
                composited = Gdk.Selection.OwnerGetForDisplay(screen.Display, atom) != null;
            }

            // FIXME check for WINDOW_OPACITY so that we support compositing on older composite manager
            // versions before they started supporting the real check given above
            if (!composited)
            {
                composited = CompositeUtils.SupportsHint(screen, "_NET_WM_WINDOW_OPACITY");
            }

            return(composited);
        }