Author: toshok
Date: 2006-10-30 23:00:03 -0500 (Mon, 30 Oct 2006)
New Revision: 67172
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NotifyIcon.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
Log:
[ fixes the oversized notify icon issue in bug #79745 ]
* NotifyIcon.cs: scale the icon down to the size we're given by
the XplatUI layer (this would be faster if we did it once instead
of whenever we paint..) Also, remove the WM_NCPAINT handling,
since it's never invoked.
* XplatUIX11.cs: the gnome and kde systrays use icons that are 24
pixels high by default, so let's hardcode our systray icon to that
size. The SYSTEM_TRAY protocol should really have a way for
client apps to query for the correct icon size.. but oh well. A
couple of patches to deal with the screwy client_window ==
whole_window notifyicon stuff (we don't want to PerformNCCalc, for
instance, and also make sure we don't XSelectInput twice).
2006-10-30 Chris Toshok <[EMAIL PROTECTED]>
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-10-31 03:51:37 UTC (rev 67171)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-10-31 04:00:03 UTC (rev 67172)
@@ -1,5 +1,22 @@
2006-10-30 Chris Toshok <[EMAIL PROTECTED]>
+ [ fixes the oversized notify icon issue in bug #79745 ]
+
+ * NotifyIcon.cs: scale the icon down to the size we're given by
+ the XplatUI layer (this would be faster if we did it once instead
+ of whenever we paint..) Also, remove the WM_NCPAINT handling,
+ since it's never invoked.
+
+ * XplatUIX11.cs: the gnome and kde systrays use icons that are 24
+ pixels high by default, so let's hardcode our systray icon to that
+ size. The SYSTEM_TRAY protocol should really have a way for
+ client apps to query for the correct icon size.. but oh well. A
+ couple of patches to deal with the screwy client_window ==
+ whole_window notifyicon stuff (we don't want to PerformNCCalc, for
+ instance, and also make sure we don't XSelectInput twice).
+
+2006-10-30 Chris Toshok <[EMAIL PROTECTED]>
+
* Control.cs: ugh, the unit test fix (CH11, yesterday) breaks when
recreating forms. Control recreation is the bane of my existence.
Fix it in a way that keeps everyone happy.
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NotifyIcon.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NotifyIcon.cs
2006-10-31 03:51:37 UTC (rev 67171)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NotifyIcon.cs
2006-10-31 04:00:03 UTC (rev 67172)
@@ -89,15 +89,6 @@
protected override void WndProc(ref Message m) {
switch((Msg)m.Msg) {
- case Msg.WM_NCPAINT: {
- PaintEventArgs paint_event;
-
- paint_event =
XplatUI.PaintEventStart(Handle, false);
- OnPaintInternal (paint_event);
- XplatUI.PaintEventEnd(Handle,
false);
- break;
- }
-
//
// NotifyIcon does CONTEXTMENU
on mouse up, not down
// so we swallow the message
here, and handle it on our own
@@ -180,7 +171,10 @@
internal override void OnPaintInternal (PaintEventArgs
e) {
if (owner.icon != null) {
e.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(SystemColors.Window),
rect);
- e.Graphics.DrawImage(owner.icon_bitmap,
rect);
+ e.Graphics.DrawImage(owner.icon_bitmap,
+ rect,
+ new Rectangle (0,
0, owner.icon_bitmap.Width, owner.icon_bitmap.Height),
+
GraphicsUnit.Pixel);
}
}
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
2006-10-31 03:51:37 UTC (rev 67171)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
2006-10-31 04:00:03 UTC (rev 67172)
@@ -2354,7 +2354,8 @@
lock (XlibLock) {
XSelectInput(DisplayHandle, hwnd.whole_window,
new IntPtr ((int)(SelectInputMask | EventMask.StructureNotifyMask)));
- XSelectInput(DisplayHandle, hwnd.client_window,
new IntPtr ((int)SelectInputMask));
+ if (hwnd.whole_window != hwnd.client_window)
+ XSelectInput(DisplayHandle,
hwnd.client_window, new IntPtr ((int)SelectInputMask));
if (StyleSet (cp.Style,
WindowStyles.WS_VISIBLE)) {
MapWindow(hwnd, WindowType.Both);
@@ -2369,7 +2370,8 @@
XSetTransientForHint (DisplayHandle,
hwnd.whole_window, RootWindow);
} else if (!ExStyleSet (cp.ExStyle,
WindowExStyles.WS_EX_APPWINDOW)) {
-// XSetTransientForHint (DisplayHandle,
hwnd.whole_window, FosterParent);
+ /* this line keeps the window from showing up
in gnome's taskbar */
+ XSetTransientForHint (DisplayHandle,
hwnd.whole_window, FosterParent);
}
SetWMStyles(hwnd, cp);
@@ -3488,7 +3490,8 @@
hwnd.configure_pending
= false;
// We need to adjust
our client window to track the resize of whole_window
- PerformNCCalc(hwnd);
+ if (hwnd.whole_window
!= hwnd.client_window)
+
PerformNCCalc(hwnd);
// }
}
goto ProcessNextMessage;
@@ -4820,16 +4823,15 @@
size_hints = new XSizeHints();
- XGetWMNormalHints(DisplayHandle,
hwnd.whole_window, ref size_hints, out dummy);
size_hints.flags =
(IntPtr)(XSizeHintsFlags.PMinSize | XSizeHintsFlags.PMaxSize |
XSizeHintsFlags.PBaseSize);
- size_hints.min_width = icon.Width;
- size_hints.min_height = icon.Height;
- size_hints.max_width = icon.Width;
- size_hints.max_height = icon.Height;
+ size_hints.min_width = 24;
+ size_hints.min_height = 24;
+ size_hints.max_width = 24;
+ size_hints.max_height = 24;
+ size_hints.base_width = 24;
+ size_hints.base_height = 24;
- size_hints.base_width = icon.Width;
- size_hints.base_height = icon.Height;
XSetWMNormalHints(DisplayHandle,
hwnd.whole_window, ref size_hints);
int[] atoms = new int[2];
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches