[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnetlib/Xsharp Display.cs, 1.18, 1.19 TopLevelWind
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnetlib/Xsharp Display.cs, 1.18, 1.19 TopLevelWindow.cs, 1.19, 1.20 |
Date: |
Wed, 03 Dec 2003 05:43:44 +0000 |
Update of /cvsroot/dotgnu-pnet/pnetlib/Xsharp
In directory subversions:/tmp/cvs-serv26809/Xsharp
Modified Files:
Display.cs TopLevelWindow.cs
Log Message:
Implement the "_NET_WM_PID" and "_NET_WM_PING" protocols.
Index: TopLevelWindow.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/TopLevelWindow.cs,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** TopLevelWindow.cs 3 Dec 2003 05:14:21 -0000 1.19
--- TopLevelWindow.cs 3 Dec 2003 05:43:39 -0000 1.20
***************
*** 24,27 ****
--- 24,28 ----
using System;
using System.Text;
+ using System.Diagnostics;
using System.Globalization;
using System.Runtime.InteropServices;
***************
*** 214,217 ****
--- 215,234 ----
}
+ #if CONFIG_EXTENDED_DIAGNOSTICS
+ // Put the process ID on the window.
+ int pid =
Process.GetCurrentProcess().Id;
+ if(pid != -1 && pid != 0)
+ {
+ Xlib.XChangeProperty
+ (display, handle,
+
Xlib.XInternAtom(display, "_NET_WM_PID",
+
Xlib.Bool.False),
+
Xlib.XInternAtom(display, "CARDINAL",
+
Xlib.Bool.False),
+ 32, 0 /*
PropModeReplace */,
+ new Xlib.Xlong []
{(Xlib.Xlong)(pid)}, 1);
+ }
+ #endif
+
// Top-level widgets receive all key
and focus events.
SelectInput(EventMask.KeyPressMask |
***************
*** 257,275 ****
private void SetProtocols(IntPtr display, Xlib.Window handle)
{
if((otherHints & OtherHints.HelpButton) != 0)
{
! Xlib.Atom[] protocols = new Xlib.Atom
[3];
! protocols[0] = dpy.wmDeleteWindow;
! protocols[1] = dpy.wmTakeFocus;
! protocols[2] = dpy.wmContextHelp;
! Xlib.XSetWMProtocols(display, handle,
protocols, 3);
! }
! else
! {
! Xlib.Atom[] protocols = new Xlib.Atom
[2];
! protocols[0] = dpy.wmDeleteWindow;
! protocols[1] = dpy.wmTakeFocus;
! Xlib.XSetWMProtocols(display, handle,
protocols, 2);
}
}
--- 274,287 ----
private void SetProtocols(IntPtr display, Xlib.Window handle)
{
+ Xlib.Atom[] protocols = new Xlib.Atom [4];
+ int numProtocols = 0;
+ protocols[numProtocols++] = dpy.wmDeleteWindow;
+ protocols[numProtocols++] = dpy.wmTakeFocus;
if((otherHints & OtherHints.HelpButton) != 0)
{
! protocols[numProtocols++] =
dpy.wmContextHelp;
}
+ protocols[numProtocols++] = dpy.wmPing;
+ Xlib.XSetWMProtocols(display, handle,
protocols, numProtocols);
}
***************
*** 1661,1673 ****
Close();
}
! if(xevent.xclient.l(0)
== (int)(dpy.wmTakeFocus))
{
// We were
given the primary input focus.
PrimaryFocusIn();
}
! if(xevent.xclient.l(0)
== (int)(dpy.wmContextHelp))
{
// The user
pressed the "help" button.
OnHelp();
}
}
--- 1673,1708 ----
Close();
}
! else
if(xevent.xclient.l(0) ==
!
(int)(dpy.wmTakeFocus))
{
// We were
given the primary input focus.
PrimaryFocusIn();
}
! else
if(xevent.xclient.l(0) ==
!
(int)(dpy.wmContextHelp))
{
// The user
pressed the "help" button.
OnHelp();
+ }
+ else
if(xevent.xclient.l(0) == (int)(dpy.wmPing))
+ {
+ // The window
manager has pinged us to see
+ // if we are
still responding or are dead.
+ // We send the
message straight back to the WM.
+ try
+ {
+ IntPtr
display = dpy.Lock();
+
xevent.xany.window =
+
screen.RootWindow.GetWidgetHandle();
+
Xlib.XSendEvent
+
(display, xevent.xany.window,
+
Xlib.Bool.False,
+
(int)(EventMask.NoEventMask),
+
ref xevent);
+ }
+ finally
+ {
+
dpy.Unlock();
+ }
}
}
Index: Display.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Display.cs,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** Display.cs 3 Dec 2003 05:14:21 -0000 1.18
--- Display.cs 3 Dec 2003 05:43:39 -0000 1.19
***************
*** 57,60 ****
--- 57,61 ----
internal Xlib.Atom wmState;
internal Xlib.Atom wmNetState;
+ internal Xlib.Atom wmPing;
internal ButtonName selectButton;
internal ButtonName menuButton;
***************
*** 112,115 ****
--- 113,118 ----
wmNetState = Xlib.XInternAtom
(dpy, "_NET_WM_STATE", Xlib.Bool.False);
+ wmPing = Xlib.XInternAtom
+ (dpy, "_NET_WM_PING", Xlib.Bool.False);
// Which buttons should we use for "Select" and
"Menu"?
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnetlib/Xsharp Display.cs, 1.18, 1.19 TopLevelWindow.cs, 1.19, 1.20,
Rhys Weatherley <address@hidden> <=