本文整理汇总了C#中System.Windows.Forms.XEvent类的典型用法代码示例。如果您正苦于以下问题:C# XEvent类的具体用法?C# XEvent怎么用?C# XEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XEvent类属于System.Windows.Forms命名空间,在下文中一共展示了XEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PropertyChanged
public override void PropertyChanged (XEvent xevent)
{
if (xevent.PropertyEvent.atom == Display.Atoms._NET_ACTIVE_WINDOW) {
IntPtr actual_atom;
int actual_format;
IntPtr nitems;
IntPtr bytes_after;
IntPtr prop = IntPtr.Zero;
Xlib.XGetWindowProperty (Display.Handle, WholeWindow,
Display.Atoms._NET_ACTIVE_WINDOW, IntPtr.Zero, new IntPtr (1), false,
Display.Atoms.XA_WINDOW, out actual_atom, out actual_format, out nitems, out bytes_after, ref prop);
if (((long)nitems > 0) && (prop != IntPtr.Zero)) {
// FIXME - is this 64 bit clean?
Display.SetActiveWindow ((X11Hwnd)Hwnd.ObjectFromHandle((IntPtr)Marshal.ReadInt32(prop)));
Xlib.XFree(prop);
}
}
else if (xevent.PropertyEvent.atom == Display.Atoms._NET_SUPPORTED) {
// we'll need to refetch the supported protocols list
refetch_net_supported = true;
_net_supported = null;
}
else
base.PropertyChanged (xevent);
}
示例2: Enqueue
public void Enqueue (XEvent xevent)
{
if (Thread.CurrentThread != thread) {
Console.WriteLine ("Hwnd.Queue.Enqueue called from a different thread without locking.");
Console.WriteLine (Environment.StackTrace);
}
xqueue.Enqueue (xevent);
}
示例3: XPeekEvent
internal extern static void XPeekEvent (IntPtr display, ref XEvent xevent);
示例4: SendNetClientMessage
void SendNetClientMessage(IntPtr window, IntPtr message_type, IntPtr l0, IntPtr l1, IntPtr l2) {
XEvent xev;
xev = new XEvent();
xev.ClientMessageEvent.type = XEventName.ClientMessage;
xev.ClientMessageEvent.send_event = true;
xev.ClientMessageEvent.window = window;
xev.ClientMessageEvent.message_type = message_type;
xev.ClientMessageEvent.format = 32;
xev.ClientMessageEvent.ptr1 = l0;
xev.ClientMessageEvent.ptr2 = l1;
xev.ClientMessageEvent.ptr3 = l2;
XSendEvent(DisplayHandle, window, false, new IntPtr ((int)EventMask.NoEventMask), ref xev);
}
示例5: SendNetWMMessage
void SendNetWMMessage(IntPtr window, IntPtr message_type, IntPtr l0, IntPtr l1, IntPtr l2, IntPtr l3) {
XEvent xev;
xev = new XEvent();
xev.ClientMessageEvent.type = XEventName.ClientMessage;
xev.ClientMessageEvent.send_event = true;
xev.ClientMessageEvent.window = window;
xev.ClientMessageEvent.message_type = message_type;
xev.ClientMessageEvent.format = 32;
xev.ClientMessageEvent.ptr1 = l0;
xev.ClientMessageEvent.ptr2 = l1;
xev.ClientMessageEvent.ptr3 = l2;
xev.ClientMessageEvent.ptr4 = l3;
XSendEvent(DisplayHandle, RootWindow, false, new IntPtr ((int) (EventMask.SubstructureRedirectMask | EventMask.SubstructureNotifyMask)), ref xev);
}
示例6: XIfEvent
internal static void XIfEvent (IntPtr display, ref XEvent xevent, Delegate event_predicate, IntPtr arg)
{
DebugHelper.TraceWriteLine ("XIfEvent");
_XIfEvent (display, ref xevent, event_predicate, arg);
}
示例7: XFilterEvent
internal static bool XFilterEvent(ref XEvent xevent, IntPtr window)
{
DebugHelper.TraceWriteLine ("XFilterEvent");
return _XFilterEvent(ref xevent, window);
}
示例8: XNextEvent
internal static IntPtr XNextEvent(IntPtr display, ref XEvent xevent)
{
DebugHelper.TraceWriteLine ("XNextEvent");
return _XNextEvent(display, ref xevent);
}
示例9: AddConfigureNotify
void AddConfigureNotify (XEvent xevent) {
Hwnd hwnd;
hwnd = Hwnd.GetObjectFromWindow(xevent.ConfigureEvent.window);
// Don't waste time
if (hwnd == null || hwnd.zombie) {
return;
}
if ((xevent.ConfigureEvent.window == hwnd.whole_window)/* && (xevent.ConfigureEvent.window == xevent.ConfigureEvent.xevent)*/) {
if (hwnd.parent == null) {
// The location given by the event is not reliable between different wm's,
// so use an alternative way of getting it.
Point location = GetTopLevelWindowLocation (hwnd);
hwnd.x = location.X;
hwnd.y = location.Y;
}
// XXX this sucks. this isn't thread safe
Control ctrl = Control.FromHandle (hwnd.Handle);
Size TranslatedSize;
if (ctrl != null) {
TranslatedSize = TranslateXWindowSizeToWindowSize (ctrl.GetCreateParams (), xevent.ConfigureEvent.width, xevent.ConfigureEvent.height);
} else {
TranslatedSize = new Size (xevent.ConfigureEvent.width, xevent.ConfigureEvent.height);
}
hwnd.width = TranslatedSize.Width;
hwnd.height = TranslatedSize.Height;
hwnd.ClientRect = Rectangle.Empty;
DriverDebug ("AddConfigureNotify (hwnd.Handle = {1}, final hwnd.rect = {0}, reported rect={2})",
new Rectangle (hwnd.x, hwnd.y, hwnd.width, hwnd.height), hwnd.Handle,
new Rectangle (xevent.ConfigureEvent.x, xevent.ConfigureEvent.y, xevent.ConfigureEvent.width, xevent.ConfigureEvent.width));
lock (hwnd.configure_lock) {
if (!hwnd.configure_pending) {
hwnd.Queue.EnqueueLocked (xevent);
hwnd.configure_pending = true;
}
}
}
// We drop configure events for Client windows
}
示例10: HandleFinishedEvent
private bool HandleFinishedEvent (ref XEvent xevent)
{
return true;
}
示例11: HandleStatusEvent
private bool HandleStatusEvent (ref XEvent xevent)
{
if (drag_data != null && drag_data.State == DragState.Entered) {
if (!QueryContinue (false, DragAction.Continue))
return true;
drag_data.WillAccept = ((int) xevent.ClientMessageEvent.ptr2 & 0x1) != 0;
GiveFeedback (xevent.ClientMessageEvent.ptr5);
}
return true;
}
示例12: Accepting_HandleLeaveEvent
private bool Accepting_HandleLeaveEvent (ref XEvent xevent)
{
if (control != null && drag_event != null)
control.DndLeave (drag_event);
// Reset ();
return true;
}
示例13: Accepting_HandleDropEvent
private bool Accepting_HandleDropEvent (ref XEvent xevent)
{
if (control != null && drag_event != null) {
drag_event = new DragEventArgs (data,
0, pos_x, pos_y,
allowed, drag_event.Effect);
control.DndDrop (drag_event);
}
SendFinished ();
return true;
}
示例14: Accepting_HandlePositionEvent
private bool Accepting_HandlePositionEvent (ref XEvent xevent)
{
pos_x = (int) xevent.ClientMessageEvent.ptr3 >> 16;
pos_y = (int) xevent.ClientMessageEvent.ptr3 & 0xFFFF;
// Copy is implicitly allowed
Control source_control = MwfWindow (source);
if (source_control == null)
allowed = EffectsFromX11Source (source, xevent.ClientMessageEvent.ptr5) | DragDropEffects.Copy;
else
allowed = drag_data.AllowedEffects;
IntPtr parent, child, new_child, last_drop_child;
parent = XplatUIX11.XRootWindow (display, 0);
child = toplevel;
last_drop_child = IntPtr.Zero;
while (true) {
int xd, yd;
new_child = IntPtr.Zero;
if (!XplatUIX11.XTranslateCoordinates (display,
parent, child, pos_x, pos_y,
out xd, out yd, out new_child))
break;
if (new_child == IntPtr.Zero)
break;
child = new_child;
Hwnd h = Hwnd.ObjectFromHandle (child);
if (h != null) {
Control d = Control.FromHandle (h.client_window);
if (d != null && d.allow_drop)
last_drop_child = child;
}
}
if (last_drop_child != IntPtr.Zero)
child = last_drop_child;
if (target != child) {
// We have moved into a new control
// or into a control for the first time
Finish ();
}
target = child;
Hwnd hwnd = Hwnd.ObjectFromHandle (target);
if (hwnd == null)
return true;
Control c = Control.FromHandle (hwnd.client_window);
if (c == null)
return true;
if (!c.allow_drop) {
SendStatus (source, DragDropEffects.None);
Finish ();
return true;
}
control = c;
position_recieved = true;
if (converts_pending > 0)
return true;
if (!status_sent) {
drag_event = new DragEventArgs (data, 0, pos_x, pos_y,
allowed, DragDropEffects.None);
control.DndEnter (drag_event);
SendStatus (source, drag_event.Effect);
status_sent = true;
} else {
drag_event.x = pos_x;
drag_event.y = pos_y;
control.DndOver (drag_event);
SendStatus (source, drag_event.Effect);
}
return true;
}
示例15: Accepting_HandleEnterEvent
private bool Accepting_HandleEnterEvent (ref XEvent xevent)
{
Reset ();
source = xevent.ClientMessageEvent.ptr1;
toplevel = xevent.AnyEvent.window;
target = IntPtr.Zero;
ConvertData (ref xevent);
return true;
}