Author: pbartok
Date: 2005-02-27 01:13:44 -0500 (Sun, 27 Feb 2005)
New Revision: 41250
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
Log:
- Destroys the caret if a window that's being destroyed contains it
- Ignores expose events coming from the X11 queue for windows that already
are destroyed
- Now uses the proper variable for handling DestroyNotify, before we marked
the wrong window as destroyed
- Improved/added some debug output
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2005-02-26 23:24:25 UTC (rev 41249)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2005-02-27 06:13:44 UTC (rev 41250)
@@ -1,5 +1,15 @@
2005-02-26 Peter Bartok <[EMAIL PROTECTED]>
+ * XplatUIX11.cs:
+ - Destroys the caret if a window that's being destroyed contains it
+ - Ignores expose events coming from the X11 queue for windows that
+ already are destroyed
+ - Now uses the proper variable for handling DestroyNotify, before we
+ marked the wrong window as destroyed
+ - Improved/added some debug output
+
+2005-02-26 Peter Bartok <[EMAIL PROTECTED]>
+
* X11Keyboard.cs: Fixes to work on 64bit systems
2005-02-26 Peter Bartok <[EMAIL PROTECTED]>
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
2005-02-26 23:24:25 UTC (rev 41249)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
2005-02-27 06:13:44 UTC (rev 41250)
@@ -37,8 +37,11 @@
// NOT COMPLETE
// define to log Window handles and relationships to stdout
-#undef DriverDebug
+#define DriverDebug
+// Extra detailed debug
+#define DriverDebugExtra
+
using System;
using System.ComponentModel;
using System.Collections;
@@ -599,7 +602,7 @@
hwnd = Hwnd.GetObjectFromWindow(xevent.AnyEvent.window);
// Don't waste time
- if (!hwnd.visible) {
+ if (hwnd == null || !hwnd.visible) {
return;
}
@@ -1684,6 +1687,11 @@
Console.WriteLine("Destroying window {0:X}",
handle.ToInt32());
#endif
+ // Make sure if the caret is in the window, that we
destroy the caret, too
+ if (Caret.Hwnd == hwnd.client_window) {
+ DestroyCaret(handle);
+ }
+
lock (XlibLock) {
if (hwnd.client_window != IntPtr.Zero) {
XDestroyWindow(DisplayHandle,
hwnd.client_window);
@@ -1836,7 +1844,7 @@
// Handle messages for windows that are already
destroyed
if (hwnd == null) {
#if DriverDebug
- Console.WriteLine("got message for
non-existant window {0:X}", xevent.AnyEvent.window.ToInt32());
+ Console.WriteLine("GetMessage(): Got
message for non-existent window {0:X}", xevent.AnyEvent.window.ToInt32());
#endif
goto ProcessNextMessage;
}
@@ -2037,6 +2045,10 @@
if (!client &&
(xevent.ConfigureEvent.xevent == xevent.ConfigureEvent.window)) { //
Ignore events for children (SubstructureNotify) and client areas
Rectangle rect;
+ #if DriverDebugExtra
+
Console.WriteLine("GetMessage(): Window {0:X} ConfigureNotify x={1} y={2}
width={3} height={4}", hwnd.client_window.ToInt32(), xevent.ConfigureEvent.x,
xevent.ConfigureEvent.y, xevent.ConfigureEvent.width,
xevent.ConfigureEvent.height);
+ #endif
+
if ((hwnd.x !=
xevent.ConfigureEvent.x) || (hwnd.y != xevent.ConfigureEvent.y) ||
(hwnd.width !=
xevent.ConfigureEvent.width) || (hwnd.height != xevent.ConfigureEvent.height)) {
msg.message=Msg.WM_WINDOWPOSCHANGED;
@@ -2079,6 +2091,9 @@
}
case XEventName.Expose: {
+ #if DriverDebugExtra
+
Console.WriteLine("GetMessage(): Window {0:X} Exposed area {1},{2} {3}x{4}",
hwnd.client_window.ToInt32(), xevent.ExposeEvent.x, xevent.ExposeEvent.y,
xevent.ExposeEvent.width, xevent.ExposeEvent.height);
+ #endif
if (Caret.Visible == 1) {
Caret.Paused = true;
HideCaret();
@@ -2096,12 +2111,23 @@
}
case XEventName.DestroyNotify: {
- msg.message=Msg.WM_DESTROY;
- #if DriverDebug
- Console.WriteLine("Got
DestroyNotify on Window {0:X}", xevent.AnyEvent.window.ToInt32());
- #endif
- hwnd.Dispose();
+ // This is a bit tricky, we don't
receive our own DestroyNotify, we only get those for our children
+ hwnd =
Hwnd.ObjectFromHandle(xevent.DestroyWindowEvent.window);
+
+ // We may get multiple for the same
window, act only one the first (when Hwnd still knows about it)
+ if (hwnd != null) {
+ msg.hwnd = hwnd.client_window;
+ msg.message=Msg.WM_DESTROY;
+ hwnd.Dispose();
+
+ #if DriverDebug
+ Console.WriteLine("Got
DestroyNotify on Window {0:X}", msg.hwnd.ToInt32());
+ #endif
+ } else {
+ goto ProcessNextMessage;
+ }
+
break;
}
@@ -2593,7 +2619,7 @@
lock (XlibLock) {
#if DriverDebug
- Console.WriteLine("Parent for window
{0:X} / {1:X} = {2:X}", hwnd.ClientWindow.ToInt32(),
hwnd.WholeWindow.ToInt32(), hwnd.parent != null ? hwnd.parent.Handle.ToInt32()
: 0);
+ Console.WriteLine("Parent for window
{0:X} / {1:X} = {2:X} (Handle:{3:X})", hwnd.ClientWindow.ToInt32(),
hwnd.WholeWindow.ToInt32(), hwnd.parent != null ? hwnd.parent.Handle.ToInt32()
: 0, parent.ToInt32());
#endif
XReparentWindow(DisplayHandle,
hwnd.whole_window, hwnd.parent.client_window, hwnd.x, hwnd.y);
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches