Ejemplo n.º 1
0
    private FilterReturn ManagerFilter(IntPtr xevent, Event evnt)
    {
        XAnyEvent xev = (XAnyEvent)Marshal.PtrToStructure(xevent, typeof(XAnyEvent));

        if (xev.type == XEventName.ClientMessage)
        {
            XClientMessageEvent xclient = (XClientMessageEvent)Marshal.PtrToStructure(xevent, typeof(XClientMessageEvent));

            if (xclient.message_type == manager_atom && xclient.data.ptr2 == selection_atom)
            {
                UpdateManagerWindow(true);
                return(FilterReturn.Continue);
            }
        }

        if (xev.window == manager_window)
        {
            if (xev.type == XEventName.PropertyNotify)
            {
                XPropertyEvent xproperty = (XPropertyEvent)Marshal.PtrToStructure(xevent, typeof(XPropertyEvent));
                if (xproperty.atom == orientation_atom)
                {
                    GetOrientationProperty();
                    return(FilterReturn.Continue);
                }
            }

            if (xev.type == XEventName.DestroyNotify)
            {
                ManagerWindowDestroyed();
            }
        }

        return(FilterReturn.Continue);
    }
Ejemplo n.º 2
0
        private void HandlePropertyChange(XPropertyEvent evt)
        {
            //event.state = 0 means a new property was added, 1 means a property was deleted, we don't care if a property got deleted.
            if (incrBuff == null || evt.atom != atomImageReturn || evt.state != 0)
            {
                return;
            }
            try
            {
                int ret = XGetWindowProperty(xConnection.XDisplay, xConnection.XCbWindow, evt.atom, 0, 0, true, new IntPtr(0), out IntPtr retType,
                                             out int format, out int nItems, out int dataSize, out IntPtr prop_return);
                XFree(prop_return);
                int rem = incrBuff.Length - incrBuffIndex;

                if (rem < dataSize)
                {
                    dataSize = rem;
                }

                XGetWindowProperty(xConnection.XDisplay, xConnection.XCbWindow, evt.atom, 0, rem, false, new IntPtr(0), out IntPtr returned_type,
                                   out format, out nItems, out int remBytes, out prop_return);

                if (dataSize == 0)
                {
                    if (incrBuffIndex != 0)
                    {
                        ISLogger.Write("INCR transfer failed ({0}/{1})", incrBuffIndex, incrBuff.Length);
                        incrBuff      = null;
                        incrBuffIndex = 0;
                    }

                    XFree(prop_return);
                    return;
                }

                Marshal.Copy(prop_return, incrBuff, incrBuffIndex, dataSize);
                incrBuffIndex += dataSize;
                ISLogger.Write("Complete: {0}/{1}", incrBuffIndex, incrBuff.Length);
                XDeleteProperty(xConnection.XDisplay, xConnection.XCbWindow, evt.atom);
                XFree(prop_return);
                XFlush(xConnection.XDisplay);
                if (incrBuff.Length == incrBuffIndex && incrBuff.Length > 0)
                {
                    ISLogger.Write("image transfer complete!");
                    OnClipboardDataChanged(new ClipboardImageData(incrBuff, true));
                    incrBuffIndex = 0;
                    incrBuff      = null;
                }
            }
            catch (Exception ex)
            {
                ISLogger.Write("{0}: INCR transfer error: {1}", ModuleName, ex.Message);
            }
        }
Ejemplo n.º 3
0
 void handleClientPropertyChange(XPropertyEvent e, Client c)
 {
 }
Ejemplo n.º 4
0
 void handlePropertyNotifyEvent(XPropertyEvent e, XWindow window)
 {
 }