[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-libs-commits] CVS: xsharp/Xsharp/XWindows Display.cs,1.2,1.3 Eve
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-libs-commits] CVS: xsharp/Xsharp/XWindows Display.cs,1.2,1.3 EventHandlers.cs,1.2,1.3 InputOnlyWidget.cs,1.4,1.5 Widget.cs,1.2,1.3 Xlib.cs.in,1.4,1.5 |
Date: |
Fri, 27 Sep 2002 23:01:03 -0400 |
Update of /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows
In directory subversions:/tmp/cvs-serv19182/Xsharp/XWindows
Modified Files:
Display.cs EventHandlers.cs InputOnlyWidget.cs Widget.cs
Xlib.cs.in
Log Message:
Implement pointer motion events; add the "Scribble" sample.
Index: Display.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/Display.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Display.cs 27 Sep 2002 07:51:11 -0000 1.2
--- Display.cs 28 Sep 2002 03:01:00 -0000 1.3
***************
*** 59,62 ****
--- 59,64 ----
internal Xlib.Atom wmDeleteWindow;
internal Xlib.Atom wmTakeFocus;
+ internal ButtonName selectButton;
+ internal ButtonName menuButton;
// Constructor.
***************
*** 98,101 ****
--- 100,115 ----
wmTakeFocus = Xlib.XInternAtom
(dpy, "WM_TAKE_FOCUS", Xlib.Bool.False);
+
+ // Which buttons should we use for "Select" and
"Menu"?
+ byte[] buttons = new byte [5];
+ if(Xlib.XGetPointerMapping(dpy, buttons, 5) ==
3)
+ {
+ menuButton = ButtonName.Button3;
+ }
+ else
+ {
+ menuButton = ButtonName.Button2;
+ }
+ selectButton = ButtonName.Button1;
}
Index: EventHandlers.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/EventHandlers.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** EventHandlers.cs 27 Sep 2002 05:54:12 -0000 1.2
--- EventHandlers.cs 28 Sep 2002 03:01:00 -0000 1.3
***************
*** 181,184 ****
--- 181,207 ----
/// <summary>
+ /// <para>The <see cref="T:XWindows.PointerMotionEventHandler"/> delegate is
+ /// used to process mouse pointer motion events.</para>
+ /// </summary>
+ ///
+ /// <param name="widget">
+ /// <para>The widget that received the event.</para>
+ /// </param>
+ ///
+ /// <param name="x">
+ /// <para>The X co-ordinate of the pointer position.</para>
+ /// </param>
+ ///
+ /// <param name="y">
+ /// <para>The Y co-ordinate of the pointer position.</para>
+ /// </param>
+ ///
+ /// <param name="modifiers">
+ /// <para>Button and shift flags that were active.</para>
+ /// </param>
+ public delegate void PointerMotionEventHandler(Widget widget, int x, int y,
+
ModifierMask modifiers);
+
+ /// <summary>
/// <para>The <see cref="T:XWindows.KeyPressEventHandler"/> delegate is
/// used to process key press events.</para>
Index: InputOnlyWidget.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/InputOnlyWidget.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** InputOnlyWidget.cs 27 Sep 2002 12:56:48 -0000 1.4
--- InputOnlyWidget.cs 28 Sep 2002 03:01:00 -0000 1.5
***************
*** 520,523 ****
--- 520,554 ----
/// <summary>
+ /// <para>Event that is raised when the mouse pointer is moved
+ /// inside this widget.</para>
+ /// </summary>
+ public event PointerMotionEventHandler PointerMotion
+ {
+ add
+ {
+ lock(this)
+ {
+ InputEventHandlers handlers =
GetHandlers();
+
SelectInput(EventMask.PointerMotionMask);
+ handlers.motion += value;
+ }
+ }
+ remove
+ {
+ lock(this)
+ {
+ if(handlers != null)
+ {
+ handlers.motion -=
value;
+ if(handlers.motion ==
null)
+ {
+
DeselectInput(EventMask.PointerMotionMask);
+ }
+ }
+ }
+ }
+ }
+
+ /// <summary>
/// <para>Event that is raised if a key is pressed when this
/// widget has the focus.</para>
***************
*** 597,600 ****
--- 628,632 ----
public ButtonReleaseEventHandler menuRelease;
public ButtonPressEventHandler menuDoubleClick;
+ public PointerMotionEventHandler motion;
public Xlib.Time lastClickTime;
public ButtonName lastClickButton;
***************
*** 642,646 ****
// Process button
events for specific buttons.
! if(button ==
ButtonName.Button1)
{
if(selectDoubleClick != null &&
--- 674,678 ----
// Process button
events for specific buttons.
! if(button ==
widget.dpy.selectButton)
{
if(selectDoubleClick != null &&
***************
*** 661,665 ****
}
}
! else
{
if(menuDoubleClick != null &&
--- 693,697 ----
}
}
! else if(button ==
widget.dpy.menuButton)
{
if(menuDoubleClick != null &&
***************
*** 695,699 ****
xevent.xbutton.state);
}
! if(button ==
ButtonName.Button1 &&
selectRelease !=
null)
{
--- 727,731 ----
xevent.xbutton.state);
}
! if(button ==
widget.dpy.selectButton &&
selectRelease !=
null)
{
***************
*** 702,706 ****
xevent.xbutton.state);
}
! else if(button !=
ButtonName.Button1 &&
menuRelease != null)
{
--- 734,738 ----
xevent.xbutton.state);
}
! else if(button ==
widget.dpy.menuButton &&
menuRelease != null)
{
***************
*** 708,711 ****
--- 740,755 ----
xevent.xbutton.y, button,
xevent.xbutton.state);
+ }
+ }
+ break;
+
+ case EventType.MotionNotify:
+ {
+ // Dispatch a pointer
motion event.
+ if(motion != null)
+ {
+ motion(widget,
xevent.xmotion.x,
+
xevent.xmotion.y,
+
xevent.xmotion.state);
}
}
Index: Widget.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/Widget.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Widget.cs 28 Sep 2002 01:06:52 -0000 1.2
--- Widget.cs 28 Sep 2002 03:01:00 -0000 1.3
***************
*** 817,820 ****
--- 817,876 ----
/// <summary>
+ /// <para>Determine if a mouse button corresponds to "Select".
+ /// Usually this is the "Left" mouse button.</para>
+ /// </summary>
+ ///
+ /// <param name="button">
+ /// <para>The button name to test.</para>
+ /// </param>
+ public bool IsSelect(ButtonName button)
+ {
+ return (button == dpy.selectButton);
+ }
+
+ /// <summary>
+ /// <para>Determine if the mouse button that corresponds to "Select"
+ /// is part of a modifier mask.</para>
+ /// </summary>
+ ///
+ /// <param name="modifiers">
+ /// <para>The modifier mask to test.</para>
+ /// </param>
+ public bool IsSelect(ModifierMask modifiers)
+ {
+ return ((((int)modifiers) &
+
(((int)(ModifierMask.Button1Mask)) <<
+
(((int)(dpy.selectButton)) - 1))) != 0);
+ }
+
+ /// <summary>
+ /// <para>Determine if a mouse button corresponds to "Menu".
+ /// Usually this is the "Right" mouse button.</para>
+ /// </summary>
+ ///
+ /// <param name="button">
+ /// <para>The button name to test.</para>
+ /// </param>
+ public bool IsMenu(ButtonName button)
+ {
+ return (button == dpy.menuButton);
+ }
+
+ /// <summary>
+ /// <para>Determine if the mouse button that corresponds to "Menu"
+ /// is part of a modifier mask.</para>
+ /// </summary>
+ ///
+ /// <param name="modifiers">
+ /// <para>The modifier mask to test.</para>
+ /// </param>
+ public bool IsMenu(ModifierMask modifiers)
+ {
+ return ((((int)modifiers) &
+
(((int)(ModifierMask.Button1Mask)) <<
+
(((int)(dpy.menuButton)) - 1))) != 0);
+ }
+
+ /// <summary>
/// <para>Copy the children of this widget into an array.</para>
/// </summary>
Index: Xlib.cs.in
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/Xlib.cs.in,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** Xlib.cs.in 27 Sep 2002 12:56:48 -0000 1.4
--- Xlib.cs.in 28 Sep 2002 03:01:00 -0000 1.5
***************
*** 403,407 ****
(IntPtr display, Xlib.Colormap colormap, ref XColor
xcolor);
! // Declare key-related external functions.
[DllImport("X11")]
--- 403,407 ----
(IntPtr display, Xlib.Colormap colormap, ref XColor
xcolor);
! // Declare key-related and pointer-related external functions.
[DllImport("X11")]
***************
*** 413,416 ****
--- 413,420 ----
extern public static KeySym XLookupKeysym
(ref XKeyEvent xevent, int index);
+
+ [DllImport("X11")]
+ extern public static @X_int@ XGetPointerMapping
+ (IntPtr display, byte[] map_return, @X_int@ nmap);
// Declare atom-related external functions.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-libs-commits] CVS: xsharp/Xsharp/XWindows Display.cs,1.2,1.3 EventHandlers.cs,1.2,1.3 InputOnlyWidget.cs,1.4,1.5 Widget.cs,1.2,1.3 Xlib.cs.in,1.4,1.5,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-libs-commits] CVS: xsharp ChangeLog,1.8,1.9
- Next by Date:
[Dotgnu-libs-commits] CVS: xsharp/samples Scribble.cs,1.1,1.2 XHello.cs,1.3,1.4
- Previous by thread:
[Dotgnu-libs-commits] CVS: xsharp ChangeLog,1.8,1.9
- Next by thread:
[Dotgnu-libs-commits] CVS: xsharp/samples Scribble.cs,1.1,1.2 XHello.cs,1.3,1.4
- Index(es):