[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/Xsharp InputOnlyWidget.cs,1.3,1.4 To
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/Xsharp InputOnlyWidget.cs,1.3,1.4 TopLevelWindow.cs,1.7,1.8 |
Date: |
Sun, 22 Jun 2003 21:04:23 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/Xsharp
In directory subversions:/tmp/cvs-serv2600/Xsharp
Modified Files:
InputOnlyWidget.cs TopLevelWindow.cs
Log Message:
Implement key event dispatching.
Index: InputOnlyWidget.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/InputOnlyWidget.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** InputOnlyWidget.cs 13 Jun 2003 21:55:56 -0000 1.3
--- InputOnlyWidget.cs 23 Jun 2003 01:04:21 -0000 1.4
***************
*** 459,462 ****
--- 459,487 ----
/// <summary>
+ /// <para>Method that is called if a key is released when this
+ /// widget has the focus.</para>
+ /// </summary>
+ ///
+ /// <param name="key">
+ /// <para>The key code.</para>
+ /// </param>
+ ///
+ /// <param name="modifiers">
+ /// <para>Other button and shift flags that were active.</para>
+ /// </param>
+ ///
+ /// <returns>
+ /// <para>Returns <see langword="true"/> if the key has been processed
+ /// and it should not be passed further up the focus tree. Returns
+ /// <see langword="false"/> if the key should be passed further up
+ /// the focus tree.</para>
+ /// </returns>
+ protected virtual bool OnKeyRelease(KeyName key, ModifierMask modifiers)
+ {
+ // Nothing to do in this class.
+ return false;
+ }
+
+ /// <summary>
/// <para>Method that is called when the mouse pointer enters
/// this widget.</para>
***************
*** 678,681 ****
--- 703,719 ----
{
return OnKeyPress(key, modifiers, str);
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ // Dispatch a key release event to this widget from the top-level
window.
+ internal bool DispatchKeyReleaseEvent(KeyName key, ModifierMask
modifiers)
+ {
+ if(FullSensitive)
+ {
+ return OnKeyRelease(key, modifiers);
}
else
Index: TopLevelWindow.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/TopLevelWindow.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** TopLevelWindow.cs 22 Jun 2003 03:19:45 -0000 1.7
--- TopLevelWindow.cs 23 Jun 2003 01:04:21 -0000 1.8
***************
*** 146,149 ****
--- 146,150 ----
// Top-level widgets receive all key
and focus events.
SelectInput(EventMask.KeyPressMask |
+
EventMask.KeyReleaseMask |
EventMask.FocusChangeMask |
EventMask.StructureNotifyMask);
***************
*** 819,822 ****
--- 820,827 ----
internal override void DispatchEvent(ref XEvent xevent)
{
+ Xlib.KeySym keysym;
+ Widget widget;
+ InputOnlyWidget io;
+
switch(xevent.type)
{
***************
*** 869,873 ****
keyBuffer =
Marshal.AllocHGlobal(32);
}
! Xlib.KeySym keysym = 0;
int len = Xlib.XLookupString
(ref xevent.xkey,
keyBuffer, 32,
--- 874,878 ----
keyBuffer =
Marshal.AllocHGlobal(32);
}
! keysym = 0;
int len = Xlib.XLookupString
(ref xevent.xkey,
keyBuffer, 32,
***************
*** 884,889 ****
// Dispatch the event.
! Widget widget = focusWidget;
! InputOnlyWidget io;
while(widget != null)
{
--- 889,893 ----
// Dispatch the event.
! widget = focusWidget;
while(widget != null)
{
***************
*** 893,896 ****
--- 897,934 ----
if(io.DispatchKeyEvent
((KeyName)keysym, xevent.xkey.state, str))
+ {
+ break;
+ }
+ }
+ if(widget == this)
+ {
+ break;
+ }
+ widget = widget.Parent;
+ }
+ }
+ break;
+
+ case EventType.KeyRelease:
+ {
+ // Convert the event into a
symbol and a string.
+ if(keyBuffer == IntPtr.Zero)
+ {
+ keyBuffer =
Marshal.AllocHGlobal(32);
+ }
+ keysym = 0;
+ int len = Xlib.XLookupString
+ (ref xevent.xkey,
keyBuffer, 32,
+ ref keysym,
IntPtr.Zero);
+
+ // Dispatch the event.
+ widget = focusWidget;
+ while(widget != null)
+ {
+ io = (widget as
InputOnlyWidget);
+ if(io != null)
+ {
+
if(io.DispatchKeyReleaseEvent
+
((KeyName)keysym, xevent.xkey.state))
{
break;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/Xsharp InputOnlyWidget.cs,1.3,1.4 TopLevelWindow.cs,1.7,1.8,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing/Toolkit IToolkitEventSink.cs,1.3,1.4
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing.Xsharp DrawingTopLevelWindow.cs,1.6,1.7 DrawingWindow.cs,1.5,1.6
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing/Toolkit IToolkitEventSink.cs,1.3,1.4
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing.Xsharp DrawingTopLevelWindow.cs,1.6,1.7 DrawingWindow.cs,1.5,1.6
- Index(es):