Esempio n. 1
0
        public void SetIcon(IWindowIconImpl?icon)
        {
            if (_isDisposed)
            {
                return;
            }
            if (!(icon is X11IconData x11icon))
            {
                return;
            }

            var w = (int)x11icon.Data[0];
            var h = (int)x11icon.Data[1];

            var pixLength           = w * h;
            var pixByteArrayCounter = 0;
            var pixByteArray        = new byte[w * h * 4];

            for (var i = 0; i < pixLength; i++)
            {
                var rawPixel = x11icon.Data[i + 2].ToUInt32();
                pixByteArray[pixByteArrayCounter++] = (byte)((rawPixel & 0xFF000000) >> 24);
                pixByteArray[pixByteArrayCounter++] = (byte)((rawPixel & 0xFF0000) >> 16);
                pixByteArray[pixByteArrayCounter++] = (byte)((rawPixel & 0xFF00) >> 8);
                pixByteArray[pixByteArrayCounter++] = (byte)(rawPixel & 0xFF);
            }

            _icon = new DbusPixmap(w, h, pixByteArray);
            _statusNotifierItemDbusObj?.SetIcon(_icon);
        }
Esempio n. 2
0
 public void SetIcon(DbusPixmap dbusPixmap)
 {
     _backingProperties.IconPixmap = new[] { dbusPixmap };
     InvalidateAll();
 }