本文整理汇总了C#中System.Windows.Forms.XEvent类的典型用法代码示例。如果您正苦于以下问题:C# XEvent类的具体用法?C# XEvent怎么用?C# XEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XEvent类属于System.Windows.Forms命名空间,在下文中一共展示了XEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:27,代码来源:X11RootHwnd.cs
示例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);
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:9,代码来源:XEventQueue.cs
示例3: XPeekEvent
internal extern static void XPeekEvent (IntPtr display, ref XEvent xevent);
开发者ID:nlhepler,项目名称:mono,代码行数:1,代码来源:XplatUIX11.cs
示例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);
}
开发者ID:nlhepler,项目名称:mono,代码行数:14,代码来源:XplatUIX11.cs
示例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);
}
开发者ID:nlhepler,项目名称:mono,代码行数:15,代码来源:XplatUIX11.cs
示例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);
}
开发者ID:nlhepler,项目名称:mono,代码行数:5,代码来源:XplatUIX11.cs
示例7: XFilterEvent
internal static bool XFilterEvent(ref XEvent xevent, IntPtr window)
{
DebugHelper.TraceWriteLine ("XFilterEvent");
return _XFilterEvent(ref xevent, window);
}
开发者ID:nlhepler,项目名称:mono,代码行数:5,代码来源:XplatUIX11.cs
示例8: XNextEvent
internal static IntPtr XNextEvent(IntPtr display, ref XEvent xevent)
{
DebugHelper.TraceWriteLine ("XNextEvent");
return _XNextEvent(display, ref xevent);
}
开发者ID:nlhepler,项目名称:mono,代码行数:5,代码来源:XplatUIX11.cs
示例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
}
开发者ID:nlhepler,项目名称:mono,代码行数:42,代码来源:XplatUIX11.cs
示例10: HandleFinishedEvent
private bool HandleFinishedEvent (ref XEvent xevent)
{
return true;
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:4,代码来源:X11Dnd.cs
示例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;
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:13,代码来源:X11Dnd.cs
示例12: Accepting_HandleLeaveEvent
private bool Accepting_HandleLeaveEvent (ref XEvent xevent)
{
if (control != null && drag_event != null)
control.DndLeave (drag_event);
// Reset ();
return true;
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:7,代码来源:X11Dnd.cs
示例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;
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:11,代码来源:X11Dnd.cs
示例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;
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:82,代码来源:X11Dnd.cs
示例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;
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:12,代码来源:X11Dnd.cs
示例16: SendInput
internal override int SendInput(IntPtr handle, Queue keys)
{
if (handle == IntPtr.Zero)
return 0;
int count = keys.Count;
Hwnd hwnd = Hwnd.ObjectFromHandle(handle);
while (keys.Count > 0) {
MSG msg = (MSG)keys.Dequeue();
XEvent xevent = new XEvent ();
xevent.type = (msg.message == Msg.WM_KEYUP ? XEventName.KeyRelease : XEventName.KeyPress);
xevent.KeyEvent.display = DisplayHandle;
if (hwnd != null) {
xevent.KeyEvent.window = hwnd.whole_window;
} else {
xevent.KeyEvent.window = IntPtr.Zero;
}
xevent.KeyEvent.keycode = Keyboard.ToKeycode((int)msg.wParam);
hwnd.Queue.EnqueueLocked (xevent);
}
return count;
}
开发者ID:nlhepler,项目名称:mono,代码行数:29,代码来源:XplatUIX11.cs
示例17: SetCursorPos
internal override void SetCursorPos(IntPtr handle, int x, int y)
{
if (handle == IntPtr.Zero) {
lock (XlibLock) {
IntPtr root, child;
int root_x, root_y, child_x, child_y, mask;
/* we need to do a
* QueryPointer before warping
* because if the warp is on
* the RootWindow, the x/y are
* relative to the current
* mouse position
*/
QueryPointer (DisplayHandle, RootWindow,
out root,
out child,
out root_x, out root_y,
out child_x, out child_y,
out mask);
XWarpPointer(DisplayHandle, IntPtr.Zero, IntPtr.Zero, 0, 0, 0, 0, x - root_x, y - root_y);
XFlush (DisplayHandle);
/* then we need to a
* QueryPointer after warping
* to manually generate a
* motion event for the window
* we move into.
*/
QueryPointer (DisplayHandle, RootWindow,
out root,
out child,
out root_x, out root_y,
out child_x, out child_y,
out mask);
Hwnd child_hwnd = Hwnd.ObjectFromHandle(child);
if (child_hwnd == null) {
return;
}
XEvent xevent = new XEvent ();
xevent.type = XEventName.MotionNotify;
xevent.MotionEvent.display = DisplayHandle;
xevent.MotionEvent.window = child_hwnd.client_window;
xevent.MotionEvent.root = RootWindow;
xevent.MotionEvent.x = child_x;
xevent.MotionEvent.y = child_y;
xevent.MotionEvent.x_root = root_x;
xevent.MotionEvent.y_root = root_y;
xevent.MotionEvent.state = mask;
child_hwnd.Queue.EnqueueLocked (xevent);
}
} else {
Hwnd hwnd;
hwnd = Hwnd.ObjectFromHandle(handle);
lock (XlibLock) {
XWarpPointer(DisplayHandle, IntPtr.Zero, hwnd.client_window, 0, 0, 0, 0, x, y);
}
}
}
开发者ID:nlhepler,项目名称:mono,代码行数:66,代码来源:XplatUIX11.cs
示例18: UpdateMessageQueue
void UpdateMessageQueue (XEventQueue queue, bool allowIdle) {
DateTime now;
int pending;
Hwnd hwnd;
now = DateTime.UtcNow;
lock (XlibLock) {
pending = XPending (DisplayHandle);
}
if (pending == 0 && allowIdle) {
if ((queue == null || queue.DispatchIdle) && Idle != null) {
Idle (this, EventArgs.Empty);
}
lock (XlibLock) {
pending = XPending (DisplayHandle);
}
}
if (pending == 0) {
int timeout = 0;
if (queue != null) {
if (queue.Paint.Count > 0)
return;
timeout = NextTimeout (queue.timer_list, now);
}
if (timeout > 0) {
#if __MonoCS__
int length = pollfds.Length - 1;
lock (wake_waiting_lock) {
if (wake_waiting == false) {
length ++;
wake_waiting = true;
}
}
Syscall.poll (pollfds, (uint)length, timeout);
// Clean out buffer, so we're not busy-looping on the same data
if (length == pollfds.Length) {
if (pollfds[1].revents != 0)
wake_receive.Receive(network_buffer, 0, 1, SocketFlags.None);
lock (wake_waiting_lock) {
wake_waiting = false;
}
}
#endif
lock (XlibLock) {
pending = XPending (DisplayHandle);
}
}
}
if (queue != null)
CheckTimers (queue.timer_list, now);
while (true) {
XEvent xevent = new XEvent ();
lock (XlibLock) {
if (XPending (DisplayHandle) == 0)
break;
XNextEvent (DisplayHandle, ref xevent);
if (xevent.AnyEvent.type == XEventName.KeyPress ||
xevent.AnyEvent.type == XEventName.KeyRelease) {
// PreFilter() handles "shift key state updates.
Keyboard.PreFilter (xevent);
if (XFilterEvent (ref xevent, Keyboard.ClientWindow)) {
// probably here we could raise WM_IME_KEYDOWN and
// WM_IME_KEYUP, but I'm not sure it is worthy.
continue;
}
}
else if (XFilterEvent (ref xevent, IntPtr.Zero))
continue;
}
hwnd = Hwnd.GetObjectFromWindow(xevent.AnyEvent.window);
if (hwnd == null)
continue;
DebugHelper.WriteLine ("UpdateMessageQueue got Event: " + xevent.ToString ());
switch (xevent.type) {
case XEventName.Expose:
AddExpose (hwnd, xevent.ExposeEvent.window == hwnd.ClientWindow, xevent.ExposeEvent.x, xevent.ExposeEvent.y, xevent.ExposeEvent.width, xevent.ExposeEvent.height);
break;
case XEventName.SelectionClear: {
// Should we do something?
break;
}
case XEventName.SelectionRequest: {
//.........这里部分代码省略.........
开发者ID:nlhepler,项目名称:mono,代码行数:101,代码来源:XplatUIX11.cs
示例19: XSendEvent
internal static int XSendEvent(IntPtr display, IntPtr window, bool propagate, IntPtr event_mask, ref XEvent send_event)
{
DebugHelper.TraceWriteLine ("XSendEvent");
return _XSendEvent(display, window, propagate, event_mask, ref send_event);
}
开发者ID:nlhepler,项目名称:mono,代码行数:5,代码来源:XplatUIX11.cs
示例20: MouseHover
void MouseHover(object sender, EventArgs e) {
XEvent xevent;
Hwnd hwnd;
HoverState.Timer.Enabled = false;
if (HoverState.Window != IntPtr.Zero) {
hwnd = Hwnd.GetObjectFromWindow(HoverState.Window);
if (hwnd != null) {
xevent = new XEvent ();
xevent.type = XEventName.ClientMessage;
xevent.ClientMessageEvent.display = DisplayHandle;
xevent.ClientMessageEvent.window = HoverState.Window;
xevent.ClientMessageEvent.message_type = HoverState.Atom;
xevent.ClientMessageEvent.format = 32;
xevent.ClientMessageEvent.ptr1 = (IntPtr) (HoverState.Y << 16 | HoverState.X);
hwnd.Queue.EnqueueLocked (xevent);
WakeupMain ();
}
}
}
开发者ID:nlhepler,项目名称:mono,代码行数:24,代码来源:XplatUIX11.cs
注:本文中的System.Windows.Forms.XEvent类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论