[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnetlib/Xsharp Display.cs, 1.15, 1.16 TopLevelWind
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnetlib/Xsharp Display.cs, 1.15, 1.16 TopLevelWindow.cs, 1.14, 1.15 |
Date: |
Tue, 02 Dec 2003 07:28:09 +0000 |
Update of /cvsroot/dotgnu-pnet/pnetlib/Xsharp
In directory subversions:/tmp/cvs-serv30371/Xsharp
Modified Files:
Display.cs TopLevelWindow.cs
Log Message:
Implement the "Help" button on caption bars under X using the
"_NET_WM_CONTEXT_HELP" window manager hint.
Index: TopLevelWindow.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/TopLevelWindow.cs,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** TopLevelWindow.cs 2 Dec 2003 06:55:50 -0000 1.14
--- TopLevelWindow.cs 2 Dec 2003 07:28:06 -0000 1.15
***************
*** 50,53 ****
--- 50,54 ----
private int minWidth, minHeight;
private int maxWidth, maxHeight;
+ private bool hasHelpButton;
/// <summary>
***************
*** 133,136 ****
--- 134,138 ----
this.expectedWidth = -1;
this.expectedHeight = -1;
+ this.hasHelpButton = false;
// Set the initial WM properties.
***************
*** 146,153 ****
// 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);
// Top-level widgets receive all key
and focus events.
--- 148,152 ----
// Ask for "WM_DELETE_WINDOW" and
"WM_TAKE_FOCUS".
! SetProtocols(display, handle);
// Top-level widgets receive all key
and focus events.
***************
*** 190,193 ****
--- 189,212 ----
}
+ // Set the WM protocols for this window.
+ private void SetProtocols(IntPtr display, Xlib.Window handle)
+ {
+ if(hasHelpButton)
+ {
+ 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);
+ }
+ }
+
// Construct the XSizeHints structure for this window.
private XSizeHints BuildSizeHints(int x, int y, int width, int height)
***************
*** 663,666 ****
--- 682,720 ----
/// <summary>
+ /// <para>Get or set the state of the "help" button in
+ /// the window's caption bar.</para>
+ /// </summary>
+ ///
+ /// <value>
+ /// <para>The value of this property is the help button state. The
window
+ /// manager might ignore this information if it does not support the
+ /// <c>_NET_WM_CONTEXT_HELP</c> protocol.</para>
+ /// </value>
+ public bool HasHelpButton
+ {
+ get
+ {
+ return hasHelpButton;
+ }
+ set
+ {
+ if(hasHelpButton != value)
+ {
+ hasHelpButton = value;
+ try
+ {
+ IntPtr display =
dpy.Lock();
+ Xlib.Window handle =
GetWidgetHandle();
+ SetProtocols(display,
handle);
+ }
+ finally
+ {
+ dpy.Unlock();
+ }
+ }
+ }
+ }
+
+ /// <summary>
/// <para>Get or set the transient parent window.</para>
/// </summary>
***************
*** 902,905 ****
--- 956,968 ----
/// <summary>
+ /// <para>Method that is called when the window's "help" box is
+ /// clicked by the user.</para>
+ /// </summary>
+ protected virtual void OnHelp()
+ {
+ // Nothing to do here.
+ }
+
+ /// <summary>
/// <para>Method that is called when the window gains the primary focus,
/// just before the actual focus is passed to children.</para>
***************
*** 1049,1052 ****
--- 1112,1120 ----
// We were
given the primary input focus.
PrimaryFocusIn();
+ }
+ if(xevent.xclient.l(0)
== (int)(dpy.wmContextHelp))
+ {
+ // The user
pressed the "help" button.
+ OnHelp();
}
}
Index: Display.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Display.cs,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Display.cs 2 Dec 2003 05:12:57 -0000 1.15
--- Display.cs 2 Dec 2003 07:28:06 -0000 1.16
***************
*** 54,57 ****
--- 54,58 ----
internal Xlib.Atom wmTakeFocus;
internal Xlib.Atom wmMwmHints;
+ internal Xlib.Atom wmContextHelp;
internal ButtonName selectButton;
internal ButtonName menuButton;
***************
*** 102,105 ****
--- 103,108 ----
wmMwmHints = Xlib.XInternAtom
(dpy, "_MOTIF_WM_HINTS",
Xlib.Bool.False);
+ wmContextHelp = Xlib.XInternAtom
+ (dpy, "_NET_WM_CONTEXT_HELP",
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.15, 1.16 TopLevelWindow.cs, 1.14, 1.15,
Rhys Weatherley <address@hidden> <=