1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 // Copyright (c) 2004-2006 Novell, Inc.
23 // Peter Bartok pbartok@novell.com
24 // Chris Toshok toshok@ximian.com
29 // This driver understands the following environment variables: (Set the var to enable feature)
31 // MONO_XEXCEPTIONS = throw an exception when a X11 error is encountered;
32 // by default a message is displayed but execution continues
34 // MONO_XSYNC = perform all X11 commands synchronous; this is slower but
35 // helps in debugging errors
40 // define to log Window handles and relationships to stdout
43 // Extra detailed debug
44 #undef DriverDebugExtra
45 #undef DriverDebugParent
46 #undef DriverDebugCreate
47 #undef DriverDebugDestroy
48 #undef DriverDebugThreads
49 #undef DriverDebugXEmbed
52 using System.ComponentModel;
53 using System.Collections;
54 using System.Diagnostics;
56 using System.Drawing.Drawing2D;
57 using System.Drawing.Imaging;
60 using System.Net.Sockets;
61 using System.Reflection;
62 using System.Runtime.InteropServices;
64 using System.Threading;
65 using System.Windows.Forms;
68 namespace System.Windows.Forms.X11Internal {
69 internal class XplatUIX11_new : XplatUIDriver {
70 #region Local Variables
72 static volatile XplatUIX11_new Instance;
73 static readonly object lockobj = new object ();
75 static bool themes_enabled;
77 static Hashtable MessageQueues; // Holds our thread-specific X11ThreadQueues
81 #endregion // Local Variables
83 private XplatUIX11_new() {
84 // Handle singleton stuff first
87 // Now regular initialization
88 MessageQueues = Hashtable.Synchronized (new Hashtable(7));
89 if (Xlib.XInitThreads() == 0) {
90 Console.WriteLine ("Failed XInitThreads. The X11 event loop will not function properly");
94 private void InitializeDisplay ()
96 display = new X11Display (Xlib.XOpenDisplay(IntPtr.Zero));
98 Graphics.FromHdcInternal (display.Handle);
102 // Remove our display handle from S.D
103 Graphics.FromHdcInternal (IntPtr.Zero);
106 #endregion // Constructors
108 #region Singleton Specific Code
109 public static XplatUIX11_new GetInstance() {
111 if (Instance == null) {
112 Instance = new XplatUIX11_new ();
114 Instance.InitializeDisplay ();
121 public int Reference {
128 #region Internal Methods
129 internal static void Where() {
130 Console.WriteLine("Here: {0}\n", GetInstance().display.WhereString());
133 #endregion // Internal Methods
135 #region Private Methods
137 internal X11ThreadQueue ThreadQueue (Thread thread)
139 X11ThreadQueue queue;
141 queue = (X11ThreadQueue)MessageQueues[thread];
143 queue = new X11ThreadQueue(thread);
144 MessageQueues[thread] = queue;
149 #endregion // Private Methods
152 #region Public Properties
153 internal override int Caption {
157 internal override Size CursorSize {
158 get { return display.CursorSize; }
161 internal override bool DragFullWindows {
165 internal override Size DragSize {
166 get { return new Size(4, 4); }
169 internal override Size FrameBorderSize {
170 get { throw new NotImplementedException(); }
173 internal override Size IconSize {
174 get { return display.IconSize; }
177 internal override int KeyboardSpeed {
178 get { return display.KeyboardSpeed; }
181 internal override int KeyboardDelay {
182 get { return display.KeyboardSpeed; }
185 internal override Size MaxWindowTrackSize {
186 get { return new Size (WorkingArea.Width, WorkingArea.Height); }
189 internal override Size MinimizedWindowSize {
190 get { return new Size(1, 1); }
193 internal override Size MinimizedWindowSpacingSize {
194 get { return new Size(1, 1); }
197 internal override Size MinimumWindowSize {
198 get { return new Size(1, 1); }
201 internal override Size MinWindowTrackSize {
202 get { return new Size(1, 1); }
205 internal override Keys ModifierKeys {
206 get { return display.ModifierKeys; }
209 internal override Size SmallIconSize {
210 get { return display.SmallIconSize; }
213 internal override int MouseButtonCount {
214 get { return 3; /* FIXME - should detect this somehow.. */}
217 internal override bool MouseButtonsSwapped {
218 get { return false; /*FIXME - how to detect? */}
221 internal override Size MouseHoverSize {
222 get { return new Size (1, 1); }
225 internal override int MouseHoverTime {
226 get { return display.MouseHoverTime; }
229 internal override bool MouseWheelPresent {
230 get { return true; /* FIXME - how to detect? */ }
233 internal override Rectangle VirtualScreen {
234 get { return WorkingArea; }
237 internal override Rectangle WorkingArea {
238 get { return display.WorkingArea; }
241 internal override bool ThemesEnabled {
242 get { return XplatUIX11_new.themes_enabled; }
246 #endregion // Public properties
248 #region Public Static Methods
249 internal override IntPtr InitializeDriver()
253 display = new X11Display (Xlib.XOpenDisplay(IntPtr.Zero));
258 internal override void ShutdownDriver(IntPtr token)
261 if (display != null) {
268 internal override void EnableThemes()
270 themes_enabled = true;
273 internal override void Activate (IntPtr handle)
275 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
281 internal override void AudibleAlert()
283 display.AudibleAlert ();
287 internal override void CaretVisible (IntPtr handle, bool visible)
289 display.CaretVisible (handle, visible);
292 // XXX this implementation should probably be shared between all non-win32 backends
293 internal override bool CalculateWindowRect (ref Rectangle ClientRect, int Style, int ExStyle, Menu menu, out Rectangle WindowRect)
295 FormBorderStyle border_style;
296 TitleStyle title_style;
298 int tool_caption_height;
300 // XXX this method should be static on Hwnd, not X11Hwnd
301 X11Hwnd.DeriveStyles (Style, ExStyle, out border_style, out title_style,
302 out caption_height, out tool_caption_height);
304 WindowRect = Hwnd.GetWindowRectangle(border_style, menu, title_style,
305 caption_height, tool_caption_height,
310 internal override void ClientToScreen (IntPtr handle, ref int x, ref int y)
312 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
315 hwnd.ClientToScreen (ref x, ref y);
318 internal override int[] ClipboardAvailableFormats (IntPtr handle)
320 return display.ClipboardAvailableFormats (handle);
323 internal override void ClipboardClose (IntPtr handle)
325 display.ClipboardClose (handle);
328 internal override int ClipboardGetID (IntPtr handle, string format)
330 return display.ClipboardGetID (handle, format);
333 internal override IntPtr ClipboardOpen (bool primary_selection)
335 return display.ClipboardOpen (primary_selection);
338 internal override object ClipboardRetrieve (IntPtr handle, int type, XplatUI.ClipboardToObject converter)
340 return display.ClipboardRetrieve (handle, type, converter);
343 internal override void ClipboardStore (IntPtr handle, object obj, int type, XplatUI.ObjectToClipboard converter)
345 display.ClipboardStore (handle, obj, type, converter);
348 internal override void CreateCaret (IntPtr handle, int width, int height)
350 display.CreateCaret (handle, width, height);
353 internal override IntPtr CreateWindow (CreateParams cp)
355 X11Hwnd hwnd = new X11Hwnd (display);
357 hwnd.CreateWindow (cp);
362 internal override IntPtr CreateWindow (IntPtr Parent, int X, int Y, int Width, int Height)
364 CreateParams create_params = new CreateParams();
366 create_params.Caption = "";
369 create_params.Width = Width;
370 create_params.Height = Height;
372 create_params.ClassName = XplatUI.DefaultClassName;
373 create_params.ClassStyle = 0;
374 create_params.ExStyle = 0;
375 create_params.Parent = IntPtr.Zero;
376 create_params.Param = 0;
378 return CreateWindow (create_params);
381 internal override IntPtr DefineCursor (Bitmap bitmap, Bitmap mask, Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot)
383 return display.DefineCursor (bitmap, mask, cursor_pixel, mask_pixel, xHotSpot, yHotSpot);
386 internal override IntPtr DefineStdCursor (StdCursor id)
388 return display.DefineStdCursor (id);
391 internal override IntPtr DefWndProc(ref Message msg)
393 X11Hwnd hwnd = (X11Hwnd)Hwnd.GetObjectFromWindow(msg.HWnd);
398 return hwnd.DefWndProc (ref msg);
401 internal override void DestroyCaret (IntPtr handle)
403 display.DestroyCaret (handle);
406 internal override void DestroyCursor(IntPtr cursor)
408 display.DestroyCursor (cursor);
411 internal override void DestroyWindow (IntPtr handle) {
414 hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
417 #if DriverDebug || DriverDebugDestroy
418 Console.WriteLine("window {0:X} already destroyed", handle.ToInt32());
423 #if DriverDebug || DriverDebugDestroy
424 Console.WriteLine("Destroying window {0}", XplatUI.Window(hwnd.ClientWindow));
427 display.DestroyWindow (hwnd);
430 internal override IntPtr DispatchMessage(ref MSG msg)
432 return display.DispatchMessage (ref msg);
435 internal override void DrawReversibleRectangle (IntPtr handle, Rectangle rect, int line_width)
437 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
440 hwnd.DrawReversibleRectangle (rect, line_width);
443 internal override void DoEvents ()
445 X11ThreadQueue queue = ThreadQueue (Thread.CurrentThread);
446 display.DoEvents (queue);
449 internal override void EnableWindow (IntPtr handle, bool Enable)
453 hwnd = Hwnd.ObjectFromHandle(handle);
455 hwnd.Enabled = Enable;
458 internal override void EndLoop (Thread thread)
460 // This is where we one day will shut down the loop for the thread
464 internal override IntPtr GetActive()
466 X11Hwnd hwnd = display.GetActiveWindow ();
468 return (hwnd == null) ? IntPtr.Zero : hwnd.Handle;
471 internal override Region GetClipRegion (IntPtr handle)
473 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
475 return (hwnd == null) ? null : hwnd.GetClipRegion ();
478 internal override void GetCursorInfo(IntPtr cursor, out int width, out int height, out int hotspot_x, out int hotspot_y)
486 internal override void GetDisplaySize(out Size size)
488 display.GetDisplaySize (out size);
491 internal override SizeF GetAutoScaleSize (Font font)
493 return display.GetAutoScaleSize (font);
496 // XXX this should be someplace shareable by all non-win32 backends.. like in Hwnd itself.
497 // maybe a Hwnd.ParentHandle property
498 internal override IntPtr GetParent (IntPtr handle)
502 hwnd = Hwnd.ObjectFromHandle(handle);
503 if (hwnd != null && hwnd.parent != null) {
504 return hwnd.parent.Handle;
509 internal override void GetCursorPos (IntPtr handle, out int x, out int y)
511 display.GetCursorPos ((X11Hwnd)Hwnd.ObjectFromHandle(handle),
515 internal override IntPtr GetFocus()
517 return display.GetFocus ();
520 // XXX this should be shared amongst non-win32 backends
521 internal override bool GetFontMetrics (Graphics g, Font font, out int ascent, out int descent)
523 return Xlib.GetFontMetrics(g.GetHdc(), font.ToHfont(), out ascent, out descent);
527 // XXX this should be shared amongst non-win32 backends
528 internal override Point GetMenuOrigin (IntPtr handle)
532 hwnd = Hwnd.ObjectFromHandle(handle);
535 return hwnd.MenuOrigin;
540 internal override bool GetMessage (object queue_id, ref MSG msg, IntPtr handle, int wFilterMin, int wFilterMax)
542 return display.GetMessage (queue_id, ref msg, handle, wFilterMin, wFilterMax);
545 internal override bool GetText (IntPtr handle, out string text)
547 X11Hwnd hwnd = (X11Hwnd) Hwnd.ObjectFromHandle(handle);
550 return hwnd != null && hwnd.GetText (out text);
553 internal override void GetWindowPos (IntPtr handle, bool is_toplevel,
554 out int x, out int y,
555 out int width, out int height,
556 out int client_width, out int client_height)
558 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
561 hwnd.GetPosition (is_toplevel, out x, out y, out width, out height, out client_width, out client_height);
564 // Should we throw an exception or fail silently?
565 // throw new ArgumentException("Called with an invalid window handle", "handle");
576 internal override FormWindowState GetWindowState (IntPtr handle)
578 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
581 return FormWindowState.Normal; // XXX should we throw an exception here? probably
583 return hwnd.GetWindowState ();
586 internal override void GrabInfo (out IntPtr handle, out bool GrabConfined, out Rectangle GrabArea)
588 display.GrabInfo (out handle, out GrabConfined, out GrabArea);
591 internal override void GrabWindow (IntPtr handle, IntPtr confine_to_handle)
593 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
594 X11Hwnd confine_to_hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(confine_to_handle);
596 display.GrabWindow (hwnd, confine_to_hwnd);
599 internal override void UngrabWindow (IntPtr handle)
601 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
603 display.UngrabWindow (hwnd);
606 internal override void HandleException(Exception e) {
607 StackTrace st = new StackTrace(e, true);
608 Console.WriteLine("Exception '{0}'", e.Message+st.ToString());
609 Console.WriteLine("{0}{1}", e.Message, st.ToString());
612 internal override void Invalidate (IntPtr handle, Rectangle rc, bool clear)
614 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
616 hwnd.Invalidate (rc, clear);
619 internal override void InvalidateNC (IntPtr handle)
621 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
623 hwnd.InvalidateNC ();
626 internal override bool IsEnabled(IntPtr handle)
628 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle (handle);
630 return hwnd != null && hwnd.Enabled;
633 internal override bool IsVisible(IntPtr handle)
635 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle (handle);
637 return hwnd != null && hwnd.Visible;
640 internal override void KillTimer (Timer timer)
642 X11ThreadQueue queue = (X11ThreadQueue) MessageQueues [timer.thread];
645 // This isn't really an error, MS doesn't start the timer if
646 // it has no assosciated queue
649 queue.KillTimer (timer);
652 internal override void MenuToScreen (IntPtr handle, ref int x, ref int y)
654 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
657 hwnd.MenuToScreen (ref x, ref y);
660 internal override void OverrideCursor (IntPtr cursor)
662 display.OverrideCursor = cursor;
665 internal override PaintEventArgs PaintEventStart (IntPtr handle, bool client)
667 return display.PaintEventStart (handle, client);
670 internal override void PaintEventEnd (IntPtr handle, bool client)
672 display.PaintEventEnd (handle, client);
676 internal override bool PeekMessage (object queue_id, ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax, uint flags)
678 return display.PeekMessage (queue_id, ref msg, hWnd, wFilterMin, wFilterMax, flags);
681 internal override bool PostMessage (IntPtr handle, Msg message, IntPtr wparam, IntPtr lparam)
683 return display.PostMessage (handle, message, wparam, lparam);
686 internal override void PostQuitMessage(int exitCode)
689 ThreadQueue(Thread.CurrentThread).PostQuitState = true;
693 internal override void RequestAdditionalWM_NCMessages (IntPtr handle, bool hover, bool leave)
695 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
698 hwnd.RequestAdditionalWM_NCMessages (hover, leave);
701 internal override void RequestNCRecalc (IntPtr handle)
703 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
706 hwnd.RequestNCRecalc ();
709 internal override void ResetMouseHover (IntPtr handle)
711 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
713 display.ResetMouseHover (hwnd);
716 internal override void ScreenToClient(IntPtr handle, ref int x, ref int y)
718 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
721 hwnd.ScreenToClient (ref x, ref y);
724 internal override void ScreenToMenu (IntPtr handle, ref int x, ref int y)
726 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
729 hwnd.ScreenToMenu (ref x, ref y);
732 internal override void ScrollWindow (IntPtr handle, Rectangle area, int XAmount, int YAmount, bool with_children)
734 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
737 hwnd.ScrollWindow (area, XAmount, YAmount, with_children);
740 internal override void ScrollWindow(IntPtr handle, int XAmount, int YAmount, bool with_children)
742 X11Hwnd hwnd = (X11Hwnd)Hwnd.GetObjectFromWindow(handle);
747 rect = hwnd.ClientRect;
750 hwnd.ScrollWindow (rect, XAmount, YAmount, with_children);
754 internal override void SendAsyncMethod (AsyncMethodData method)
756 display.SendAsyncMethod (method);
759 // XXX this is likely shareable amongst other backends
760 internal override IntPtr SendMessage (IntPtr handle, Msg message, IntPtr wParam, IntPtr lParam)
762 return display.SendMessage (handle, message, wParam, lParam);
765 internal override void SetAllowDrop (IntPtr handle, bool value)
767 // We allow drop on all windows
770 internal override DragDropEffects StartDrag (IntPtr handle, object data,
771 DragDropEffects allowed_effects)
773 return display.StartDrag (handle, data, allowed_effects);
776 internal override void SetBorderStyle (IntPtr handle, FormBorderStyle border_style)
778 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
781 hwnd.SetBorderStyle (border_style);
784 internal override void SetCaretPos (IntPtr handle, int x, int y)
786 display.SetCaretPos (handle, x, y);
789 internal override void SetClipRegion (IntPtr handle, Region region)
791 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
794 hwnd.SetClipRegion (region);
797 internal override void SetCursor (IntPtr handle, IntPtr cursor)
799 display.SetCursor (handle, cursor);
802 internal override void SetCursorPos (IntPtr handle, int x, int y)
804 if (handle == IntPtr.Zero) {
805 display.SetCursorPos (x, y);
808 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
810 hwnd.SetCursorPos (x, y);
814 internal override void SetFocus (IntPtr handle)
816 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
818 display.SetFocus (hwnd);
821 internal override void SetIcon(IntPtr handle, Icon icon)
823 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);;
829 internal override void SetMenu(IntPtr handle, Menu menu)
831 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
836 internal override void SetModal(IntPtr handle, bool Modal)
838 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
841 display.SetModal (hwnd, Modal);
844 internal override IntPtr SetParent(IntPtr handle, IntPtr parent)
846 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
847 X11Hwnd parent_hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(parent);
850 hwnd.SetParent (parent_hwnd);
855 internal override void SetTimer (Timer timer)
857 X11ThreadQueue queue = (X11ThreadQueue) MessageQueues [timer.thread];
860 // This isn't really an error, MS doesn't start the timer if
861 // it has no assosciated queue
864 queue.SetTimer (timer);
867 internal override bool SetTopmost(IntPtr handle, IntPtr handle_owner, bool enabled)
871 hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
876 X11Hwnd hwnd_owner = (X11Hwnd)Hwnd.ObjectFromHandle(handle_owner);
878 return hwnd.SetTopmost (hwnd_owner, enabled);
881 internal override bool SetVisible (IntPtr handle, bool visible, bool activate)
883 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
885 return hwnd != null && hwnd.SetVisible (visible, activate);
888 internal override void SetWindowMinMax (IntPtr handle, Rectangle maximized, Size min, Size max)
890 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
895 hwnd.SetMinMax (maximized, min, max);
898 internal override void SetWindowPos (IntPtr handle, int x, int y, int width, int height)
900 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
903 hwnd.SetPosition (x, y, width, height);
906 internal override void SetWindowState (IntPtr handle, FormWindowState state)
908 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
911 hwnd.SetWindowState (state);
914 internal override void SetWindowStyle (IntPtr handle, CreateParams cp)
916 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
919 hwnd.SetHwndStyles (cp);
920 hwnd.SetWMStyles (cp);
924 internal override double GetWindowTransparency (IntPtr handle)
926 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
929 return hwnd.GetWindowTransparency ();
934 internal override void SetWindowTransparency (IntPtr handle, double transparency, Color key)
936 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
939 hwnd.SetWindowTransparency (transparency, key);
942 internal override bool SetZOrder (IntPtr handle, IntPtr after_handle, bool top, bool bottom)
944 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
946 if (hwnd == null || !hwnd.mapped)
949 X11Hwnd after_hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(after_handle);
951 return hwnd.SetZOrder (after_hwnd, top, bottom);
954 internal override void ShowCursor (bool show)
956 display.ShowCursor (show);
959 internal override object StartLoop(Thread thread)
961 return (object) ThreadQueue(thread);
964 internal override TransparencySupport SupportsTransparency()
966 return display.SupportsTransparency ();
969 internal override bool SystrayAdd (IntPtr handle, string tip, Icon icon, out ToolTip tt)
971 return display.SystrayAdd (handle, tip, icon, out tt);
974 internal override bool SystrayChange (IntPtr handle, string tip, Icon icon, ref ToolTip tt)
976 return display.SystrayChange (handle, tip, icon, ref tt);
979 internal override void SystrayRemove (IntPtr handle, ref ToolTip tt)
981 display.SystrayRemove (handle, ref tt);
984 internal override bool Text (IntPtr handle, string text)
986 X11Hwnd hwnd = (X11Hwnd) Hwnd.ObjectFromHandle(handle);
994 internal override bool TranslateMessage (ref MSG msg)
996 return display.TranslateMessage (ref msg);
999 internal override void UpdateWindow (IntPtr handle)
1001 X11Hwnd hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
1007 #endregion // Public Static Methods
1010 internal override event EventHandler Idle {
1012 Console.WriteLine ("adding idle handler for thread {0}", Thread.CurrentThread.GetHashCode());
1013 X11ThreadQueue queue = ThreadQueue(Thread.CurrentThread);
1014 queue.Idle += value;
1017 X11ThreadQueue queue = ThreadQueue(Thread.CurrentThread);
1018 queue.Idle += value;
1021 #endregion // Events