static XplatUI() { // Compose name with current domain id because on Win32 we register class name // and name must be unique to process. If we load MWF into multiple appdomains // and try to register same class name we fail. // default_class_name = "SWFClass" + System.Threading.Thread.GetDomainID ().ToString (); Console.WriteLine("XplatUI constructor"); if (RunningOnUnix) { //if (Environment.GetEnvironmentVariable ("not_supported_MONO_MWF_USE_NEW_X11_BACKEND") != null) { // driver=XplatUIX11_new.GetInstance (); //} else if (Environment.GetEnvironmentVariable("MONO_MWF_MAC_FORCE_X11") != null) { driver = XplatUIX11.GetInstance(); } else { IntPtr buf = Marshal.AllocHGlobal(8192); // This is a hacktastic way of getting sysname from uname () if (uname(buf) != 0) { // WTF: We cannot run uname driver = XplatUIX11.GetInstance(); } else { string os = Marshal.PtrToStringAnsi(buf); if (os == "Darwin") { driver = XplatUICarbon.GetInstance(); } else { driver = XplatUIX11.GetInstance(); } } Marshal.FreeHGlobal(buf); } } else { //driver=XplatUIWin32.GetInstance (); driver = XplatUINanoX.GetInstance(); } driver.InitializeDriver(); // Initialize things that need to be done after the driver is ready DataFormats.GetFormat(0); // Signal that the Application loop can be run. // This allows UIA to initialize a11y support for MWF // before the main loop begins. Application.FirePreRun(); }
internal static bool HandleEvent(IntPtr callref, IntPtr eventref, IntPtr handle, uint kind, ref MSG msg) { Control control; DataObject data; DragEventArgs drag_event; DragDropEffects allowed; QDPoint point = new QDPoint(); UInt32 actions = 0; IntPtr dragref = IntPtr.Zero; Hwnd hwnd = Hwnd.ObjectFromHandle(handle); if (hwnd == null || hwnd.Handle != handle) { return(false); } GetEventParameter(eventref, kEventParamDragRef, typeDragRef, IntPtr.Zero, (uint)Marshal.SizeOf(typeof(IntPtr)), IntPtr.Zero, ref dragref); XplatUICarbon.GetGlobalMouse(ref point); GetDragAllowableActions(dragref, ref actions); control = Control.FromHandle(hwnd.Handle); allowed = DragActionsToEffects(actions); data = DragToDataObject(dragref); drag_event = new DragEventArgs(data, 0, point.x, point.y, allowed, DragDropEffects.None); switch (kind) { case ControlHandler.kEventControlDragEnter: { bool accept = control.AllowDrop; SetEventParameter(eventref, ControlHandler.kEventParamControlLikesDrag, ControlHandler.typeBoolean, (uint)Marshal.SizeOf(typeof(bool)), ref accept); control.DndEnter(drag_event); effects = drag_event.Effect; return(false); } case ControlHandler.kEventControlDragWithin: control.DndOver(drag_event); effects = drag_event.Effect; break; case ControlHandler.kEventControlDragLeave: control.DndLeave(drag_event); break; case ControlHandler.kEventControlDragReceive: control.DndDrop(drag_event); break; } return(true); }
static XplatUI() { // Compose name with current domain id because on Win32 we register class name // and name must be unique to process. If we load MWF into multiple appdomains // and try to register same class name we fail. // default_class_name = "SWFClass" + System.Threading.Thread.GetDomainID ().ToString (); if (RunningOnUnix) { #if NO_X11 #if NO_CARBON driver = XplatUICocoa.GetInstance(); #else driver = XplatUICarbon.GetInstance(); #endif #else //if (Environment.GetEnvironmentVariable ("not_supported_MONO_MWF_USE_NEW_X11_BACKEND") != null) { // driver=XplatUIX11_new.GetInstance (); //} else if (Environment.GetEnvironmentVariable("MONO_MWF_MAC_FORCE_X11") != null) { driver = XplatUIX11.GetInstance(); } else { IntPtr buf = Marshal.AllocHGlobal(8192); // This is a hacktastic way of getting sysname from uname () if (uname(buf) != 0) { // WTF: We cannot run uname driver = XplatUIX11.GetInstance(); } else { string os = Marshal.PtrToStringAnsi(buf); if (os == "Darwin") #if NO_CARBON { driver = XplatUICocoa.GetInstance(); } #else { driver = XplatUICarbon.GetInstance(); } #endif else { driver = XplatUIX11.GetInstance(); } }
public DragDropEffects StartDrag(IntPtr handle, object data, DragDropEffects allowed_effects) { IntPtr dragref = IntPtr.Zero; EventRecord eventrecord = new EventRecord(); effects = DragDropEffects.None; NewDrag(ref dragref); XplatUICarbon.GetGlobalMouse(ref eventrecord.mouse); StoreObjectInDrag(handle, dragref, data); TrackDrag(dragref, ref eventrecord, IntPtr.Zero); DisposeDrag(dragref); return(effects); }
public bool ProcessEvent(IntPtr callref, IntPtr eventref, IntPtr handle, uint kind, ref MSG msg) { switch (kind) { case kEventAppActivated: { foreach (IntPtr utility_window in XplatUICarbon.UtilityWindows) { if (!XplatUICarbon.IsWindowVisible(utility_window)) { XplatUICarbon.ShowWindow(utility_window); } } break; } case kEventAppDeactivated: { if (XplatUICarbon.FocusWindow != IntPtr.Zero) { Driver.SendMessage(XplatUICarbon.FocusWindow, Msg.WM_KILLFOCUS, IntPtr.Zero, IntPtr.Zero); } if (XplatUICarbon.Grab.Hwnd != IntPtr.Zero) { Driver.SendMessage(Hwnd.ObjectFromHandle(XplatUICarbon.Grab.Hwnd).Handle, Msg.WM_LBUTTONDOWN, (IntPtr)MsgButtons.MK_LBUTTON, (IntPtr)(Driver.MousePosition.X << 16 | Driver.MousePosition.Y)); } foreach (IntPtr utility_window in XplatUICarbon.UtilityWindows) { if (XplatUICarbon.IsWindowVisible(utility_window)) { XplatUICarbon.HideWindow(utility_window); } } break; } } return(true); }
public EventHandlerBase(XplatUICarbon driver) { Driver = driver; }
public bool ProcessEvent(IntPtr callref, IntPtr eventref, IntPtr handle, uint kind, ref MSG msg) { IntPtr window = Driver.HandleToWindow(handle); Hwnd hwnd = Hwnd.ObjectFromHandle(window); if (window != IntPtr.Zero) { switch (kind) { case kEventWindowActivated: { Control c = Control.FromHandle(hwnd.client_window); if (c != null) { Form form = c.FindForm(); if (form != null && !form.IsDisposed) { Driver.SendMessage(form.Handle, Msg.WM_ACTIVATE, (IntPtr)WindowActiveFlags.WA_ACTIVE, IntPtr.Zero); XplatUICarbon.ActiveWindow = hwnd.client_window; } } foreach (IntPtr utility_window in XplatUICarbon.UtilityWindows) { if (utility_window != handle && !XplatUICarbon.IsWindowVisible(utility_window)) { XplatUICarbon.ShowWindow(utility_window); } } break; } case kEventWindowExpanding: foreach (IntPtr utility_window in XplatUICarbon.UtilityWindows) { if (utility_window != handle && !XplatUICarbon.IsWindowVisible(utility_window)) { XplatUICarbon.ShowWindow(utility_window); } } msg.hwnd = hwnd.Handle; msg.message = Msg.WM_ENTERSIZEMOVE; return(true); case kEventWindowExpanded: NativeWindow.WndProc(hwnd.Handle, Msg.WM_WINDOWPOSCHANGED, IntPtr.Zero, IntPtr.Zero); msg.hwnd = hwnd.Handle; msg.message = Msg.WM_EXITSIZEMOVE; return(true); case kEventWindowDeactivated: { Control c = Control.FromHandle(hwnd.client_window); if (c != null) { Form form = c.FindForm(); if (form != null && XplatUICarbon.UnactiveWindow != form.Handle) { Driver.SendMessage(form.Handle, Msg.WM_ACTIVATE, (IntPtr)WindowActiveFlags.WA_INACTIVE, IntPtr.Zero); XplatUICarbon.ActiveWindow = IntPtr.Zero; } } foreach (IntPtr utility_window in XplatUICarbon.UtilityWindows) { if (utility_window != handle && XplatUICarbon.IsWindowVisible(utility_window)) { XplatUICarbon.HideWindow(utility_window); } } break; } case kEventWindowCollapsing: foreach (IntPtr utility_window in XplatUICarbon.UtilityWindows) { if (utility_window != handle && XplatUICarbon.IsWindowVisible(utility_window)) { XplatUICarbon.HideWindow(utility_window); } } msg.hwnd = hwnd.Handle; msg.message = Msg.WM_ENTERSIZEMOVE; return(true); case kEventWindowCollapsed: NativeWindow.WndProc(hwnd.Handle, Msg.WM_WINDOWPOSCHANGED, IntPtr.Zero, IntPtr.Zero); msg.hwnd = hwnd.Handle; msg.message = Msg.WM_EXITSIZEMOVE; return(true); case kEventWindowClose: NativeWindow.WndProc(hwnd.Handle, Msg.WM_CLOSE, IntPtr.Zero, IntPtr.Zero); return(false); case kEventWindowShown: { msg.message = Msg.WM_SHOWWINDOW; msg.lParam = (IntPtr)1; msg.wParam = (IntPtr)0; msg.hwnd = hwnd.Handle; return(true); } case kEventWindowResizeStarted: { msg.message = Msg.WM_ENTERSIZEMOVE; msg.hwnd = hwnd.Handle; return(true); } case kEventWindowResizeCompleted: { msg.message = Msg.WM_EXITSIZEMOVE; msg.hwnd = hwnd.Handle; return(true); } case kEventWindowBoundsChanged: { Rect window_bounds = new Rect(); HIRect view_bounds = new HIRect(); Size size; GetWindowBounds(handle, 33, ref window_bounds); view_bounds.size.width = window_bounds.right - window_bounds.left; view_bounds.size.height = window_bounds.bottom - window_bounds.top; HIViewSetFrame(hwnd.WholeWindow, ref view_bounds); size = XplatUICarbon.TranslateQuartzWindowSizeToWindowSize(Control.FromHandle(hwnd.Handle).GetCreateParams(), (int)view_bounds.size.width, (int)view_bounds.size.height); hwnd.X = (int)window_bounds.left; hwnd.Y = (int)window_bounds.top; hwnd.Width = (int)size.Width; hwnd.Height = (int)size.Height; Driver.PerformNCCalc(hwnd); msg.hwnd = hwnd.Handle; msg.message = Msg.WM_WINDOWPOSCHANGED; Driver.SetCaretPos(XplatUICarbon.Caret.Hwnd, XplatUICarbon.Caret.X, XplatUICarbon.Caret.Y); return(true); } } } return(false); }
internal WindowHandler(XplatUICarbon driver) : base(driver) { }
internal MouseHandler (XplatUICarbon driver) : base (driver) {}
internal MouseHandler(XplatUICarbon driver) : base(driver) { }
internal KeyboardHandler(XplatUICarbon driver) : base(driver) { }
internal ControlHandler(XplatUICarbon driver) : base(driver) { }
internal HIObjectHandler (XplatUICarbon driver) : base (driver) {}
internal ControlHandler (XplatUICarbon driver) : base (driver) {}
public EventHandlerBase (XplatUICarbon driver) { Driver = driver; }
internal static void TrackingCallback(short message, IntPtr window, IntPtr data, IntPtr dragref) { XplatUICarbon.GetInstance().FlushQueue(); }
static Pasteboard() { PasteboardCreate(XplatUICarbon.__CFStringMakeConstantString("com.apple.pasteboard.clipboard"), ref primary_pbref); PasteboardCreate(IntPtr.Zero, ref app_pbref); internal_format = XplatUICarbon.__CFStringMakeConstantString("com.novell.mono.mwf.pasteboard"); }
internal HIObjectHandler(XplatUICarbon driver) : base(driver) { }
internal KeyboardHandler (XplatUICarbon driver) : base (driver) {}
internal ApplicationHandler(XplatUICarbon driver) : base(driver) { }
internal ApplicationHandler (XplatUICarbon driver) : base (driver) {}