[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.1.1.1,1.2
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-libs-commits] CVS: xsharp/Xsharp/XWindows Display.cs,1.1.1.1,1.2 InputOnlyWidget.cs,1.2,1.3 TopLevelWindow.cs,1.1.1.1,1.2 Xlib.cs.in,1.2,1.3 |
Date: |
Fri, 27 Sep 2002 03:51:13 -0400 |
Update of /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows
In directory subversions:/tmp/cvs-serv5518/Xsharp/XWindows
Modified Files:
Display.cs InputOnlyWidget.cs TopLevelWindow.cs Xlib.cs.in
Log Message:
Add the "WM_PROTOCOLS" property to top-level windows and handle
the "WM_DELETE_WINDOW" client message.
Index: Display.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/Display.cs,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** Display.cs 26 Sep 2002 10:32:41 -0000 1.1.1.1
--- Display.cs 27 Sep 2002 07:51:11 -0000 1.2
***************
*** 56,59 ****
--- 56,62 ----
private static Hashtable others;
private static bool threadsInited;
+ internal Xlib.Atom wmProtocols;
+ internal Xlib.Atom wmDeleteWindow;
+ internal Xlib.Atom wmTakeFocus;
// Constructor.
***************
*** 87,90 ****
--- 90,101 ----
handleMap = new Hashtable();
}
+
+ // Initialize the standard window manager atoms
that we use.
+ wmProtocols = Xlib.XInternAtom
+ (dpy, "WM_PROTOCOLS", Xlib.Bool.False);
+ wmDeleteWindow = Xlib.XInternAtom
+ (dpy, "WM_DELETE_WINDOW",
Xlib.Bool.False);
+ wmTakeFocus = Xlib.XInternAtom
+ (dpy, "WM_TAKE_FOCUS", Xlib.Bool.False);
}
***************
*** 719,723 ****
current = exposeList;
prev = null;
! while(widget != null && current != widget)
{
prev = current;
--- 730,734 ----
current = exposeList;
prev = null;
! while(current != null && current != widget)
{
prev = current;
Index: InputOnlyWidget.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/InputOnlyWidget.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** InputOnlyWidget.cs 27 Sep 2002 05:54:12 -0000 1.2
--- InputOnlyWidget.cs 27 Sep 2002 07:51:11 -0000 1.3
***************
*** 146,149 ****
--- 146,150 ----
DrawableKind.Widget, parent)
{
+ bool ok = false;
try
{
***************
*** 197,206 ****
layer = 0x7FFFFFFF;
Layer = 0;
}
finally
{
! // Creation failed, so detach ourselves
from
! // the parent's widget tree.
! Detach();
}
}
--- 198,211 ----
layer = 0x7FFFFFFF;
Layer = 0;
+ ok = true;
}
finally
{
! if(!ok)
! {
! // Creation failed, so detach
ourselves from
! // the parent's widget tree.
! Detach();
! }
}
}
Index: TopLevelWindow.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/TopLevelWindow.cs,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** TopLevelWindow.cs 26 Sep 2002 10:32:43 -0000 1.1.1.1
--- TopLevelWindow.cs 27 Sep 2002 07:51:11 -0000 1.2
***************
*** 25,28 ****
--- 25,29 ----
using System;
using XWindows.Types;
+ using XWindows.Events;
/// <summary>
***************
*** 117,120 ****
--- 118,127 ----
Xlib.XStoreName(display, handle, name);
Xlib.XSetIconName(display, handle,
name);
+
+ // Ask for "WM_DELETE_WINDOW" and
"WM_TAKE_FOCUS".
+ Xlib.Atom[] protocols = new Xlib.Atom
[2];
+ protocols[0] = dpy.wmDeleteWindow;
+ protocols[1] = dpy.wmTakeFocus;
+ Xlib.XSetWMProtocols(display, handle,
protocols, 2);
}
finally
***************
*** 386,389 ****
--- 393,422 ----
/// </remarks>
public event ClosedEventHandler Closed;
+
+ // Dispatch an event to this widget.
+ internal override void DispatchEvent(ref XEvent xevent)
+ {
+ switch(xevent.type)
+ {
+ case EventType.ClientMessage:
+ {
+ if(xevent.xclient.message_type
== dpy.wmProtocols)
+ {
+ if(xevent.xclient.l(0)
==
+
(int)(dpy.wmDeleteWindow))
+ {
+ // User wants
the window to close.
+ Close();
+ }
+ if(xevent.xclient.l(0)
== (int)(dpy.wmTakeFocus))
+ {
+ // We have
received the input focus.
+ }
+ }
+ }
+ break;
+ }
+ base.DispatchEvent(ref xevent);
+ }
} // class TopLevelWindow
Index: Xlib.cs.in
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/Xlib.cs.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Xlib.cs.in 27 Sep 2002 05:54:12 -0000 1.2
--- Xlib.cs.in 27 Sep 2002 07:51:11 -0000 1.3
***************
*** 379,382 ****
--- 379,386 ----
(IntPtr display, Xlib.Window w, String window_name);
+ [DllImport("X11")]
+ extern public static Status XSetWMProtocols
+ (IntPtr display, Xlib.Window w, Atom[] protocols,
@X_int@ count);
+
// Declare color-related external functions.
***************
*** 395,398 ****
--- 399,408 ----
extern public static KeySym XLookupKeysym
(ref XKeyEvent xevent, int index);
+
+ // Declare atom-related external functions.
+
+ [DllImport("X11")]
+ extern public static Atom XInternAtom
+ (IntPtr display, String name, Bool only_if_exists);
} // class Xlib
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-libs-commits] CVS: xsharp/Xsharp/XWindows Display.cs,1.1.1.1,1.2 InputOnlyWidget.cs,1.2,1.3 TopLevelWindow.cs,1.1.1.1,1.2 Xlib.cs.in,1.2,1.3,
Rhys Weatherley <address@hidden> <=