protected override void OnRealized() { WidgetFlags |= WidgetFlags.Realized | WidgetFlags.NoWindow; GdkWindow = Parent.GdkWindow; Gdk.WindowAttr attributes = new Gdk.WindowAttr(); attributes.WindowType = Gdk.WindowType.Child; attributes.X = Allocation.X; attributes.Y = Allocation.Y; attributes.Width = Allocation.Width; attributes.Height = Allocation.Height; attributes.Wclass = Gdk.WindowClass.InputOnly; attributes.EventMask = (int)( Gdk.EventMask.PointerMotionMask | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask | Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.ExposureMask); Gdk.WindowAttributesType attributes_mask = Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Wmclass; event_window = new Gdk.Window(GdkWindow, attributes, attributes_mask); event_window.UserData = Handle; Style = Gtk.Rc.GetStyleByPaths(Settings, "*.GtkEntry", "*.GtkEntry", GType); base.OnRealized(); }
protected void CreateVideoWindow() { if (video_window != null) { return; } var attributes = new Gdk.WindowAttr { WindowType = Gdk.WindowType.Child, X = 0, Y = 0, Width = 0, Height = 0, Visual = Visual, Wclass = Gdk.WindowWindowClass.InputOutput, EventMask = (int)(Gdk.EventMask.ExposureMask | Gdk.EventMask.VisibilityNotifyMask) }; Gdk.WindowAttributesType attributes_mask = Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Visual; video_window = new Gdk.Window(null, attributes, attributes_mask); video_window.UserData = Handle; }
protected override void OnRealized() { WidgetFlags |= WidgetFlags.Realized; GdkWindow = Parent.GdkWindow; if (video_window != null) { video_window.Reparent(GdkWindow, 0, 0); video_window.MoveResize(Allocation.X, Allocation.Y, Allocation.Width, Allocation.Height); video_window.ShowUnraised(); return; } Gdk.WindowAttr attributes = new Gdk.WindowAttr(); attributes.WindowType = Gdk.WindowType.Child; attributes.X = 0; attributes.Y = 0; attributes.Width = Allocation.Width; attributes.Height = Allocation.Height; attributes.Visual = Visual; attributes.Wclass = Gdk.WindowClass.InputOutput; attributes.Colormap = Colormap; attributes.EventMask = (int)(Gdk.EventMask.ExposureMask | Gdk.EventMask.VisibilityNotifyMask); Gdk.WindowAttributesType attributes_mask = Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Visual | Gdk.WindowAttributesType.Colormap; video_window = new Gdk.Window(GdkWindow, attributes, attributes_mask); video_window.UserData = Handle; video_window.SetBackPixmap(null, false); if (ServiceManager.PlayerEngine.VideoDisplayContextType == VideoDisplayContextType.GdkWindow) { ServiceManager.PlayerEngine.VideoDisplayContext = video_window.Handle; } else { ServiceManager.PlayerEngine.VideoDisplayContext = IntPtr.Zero; } }
static private void OnRealized(object obj, EventArgs args) { Window window = obj as Window; if (obj == null) { return; } window.WidgetFlags |= WidgetFlags.Realized; Gdk.WindowAttr attrs = new Gdk.WindowAttr(); attrs.Mask = window.Events | (Gdk.EventMask.ExposureMask | Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.StructureMask); attrs.X = window.Allocation.X; attrs.Y = window.Allocation.Y; attrs.Width = window.Allocation.Width; attrs.Height = window.Allocation.Height; attrs.Wclass = Gdk.WindowClass.InputOutput; attrs.Visual = window.Visual; attrs.Colormap = window.Colormap; attrs.WindowType = Gdk.WindowType.Child; Gdk.WindowAttributesType mask = Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Colormap | Gdk.WindowAttributesType.Visual; window.GdkWindow = new Gdk.Window(window.ParentWindow, attrs, mask); window.GdkWindow.UserData = window.Handle; window.Style = window.Style.Attach(window.GdkWindow); window.Style.SetBackground(window.GdkWindow, StateType.Normal); // FIXME: gtk-sharp 2.6 // window.GdkWindow.EnableSynchronizedConfigure (); }
private void CreateVideoWindow() { if (video_window != null) { return; } var attributes = new Gdk.WindowAttr() { WindowType = Gdk.WindowType.Child, X = 0, Y = 0, Width = 0, Height = 0, Visual = Visual, Wclass = Gdk.WindowClass.InputOutput, Colormap = Colormap, EventMask = (int)(Gdk.EventMask.ExposureMask | Gdk.EventMask.VisibilityNotifyMask) }; Gdk.WindowAttributesType attributes_mask = Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Visual | Gdk.WindowAttributesType.Colormap; video_window = new Gdk.Window(null, attributes, attributes_mask); video_window.UserData = Handle; video_window.SetBackPixmap(null, false); if (ServiceManager.PlayerEngine.VideoDisplayContextType == VideoDisplayContextType.GdkWindow) { ServiceManager.PlayerEngine.VideoDisplayContext = video_window.Handle; ServiceManager.PlayerEngine.VideoWindowRealize(video_window.Handle); } else { ServiceManager.PlayerEngine.VideoDisplayContext = IntPtr.Zero; } }
protected override void OnRealized() { WidgetFlags |= WidgetFlags.Realized; Gdk.WindowAttr attributes = new Gdk.WindowAttr(); attributes.X = Allocation.X; attributes.Y = Allocation.Y; attributes.Height = Allocation.Height; attributes.Width = Allocation.Width; attributes.WindowType = Gdk.WindowType.Child; attributes.Wclass = Gdk.WindowClass.InputOutput; attributes.Visual = Visual; attributes.TypeHint = (Gdk.WindowTypeHint) 100; // Custom value which means the this gdk window has to use a native window attributes.Colormap = Colormap; attributes.EventMask = (int)(Events | Gdk.EventMask.ExposureMask | Gdk.EventMask.Button1MotionMask | Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask); Gdk.WindowAttributesType attributes_mask = Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Colormap | Gdk.WindowAttributesType.Visual; GdkWindow = new Gdk.Window(ParentWindow, attributes, (int)attributes_mask); GdkWindow.UserData = Handle; Style = Style.Attach(GdkWindow); Style.SetBackground(GdkWindow, State); this.WidgetFlags &= ~WidgetFlags.NoWindow; // Remove the gdk window from the original location and move it to the GtkEmbed view that contains it var gw = GtkMacInterop.GetNSView(this); gw.RemoveFromSuperview(); embedParent.AddSubview(gw); gw.Frame = new CoreGraphics.CGRect(0, 0, embedParent.Frame.Width, embedParent.Frame.Height); }
protected override void OnRealized() { WidgetFlags |= WidgetFlags.Realized; Gdk.WindowAttr attributes = new Gdk.WindowAttr(); attributes.X = Allocation.X; attributes.Y = Allocation.Y; attributes.Height = Allocation.Height; attributes.Width = Allocation.Width; attributes.WindowType = Gdk.WindowType.Child; attributes.Wclass = Gdk.WindowClass.InputOutput; attributes.Visual = Visual; attributes.Colormap = Colormap; attributes.EventMask = (int)(Events | Gdk.EventMask.ExposureMask | Gdk.EventMask.Button1MotionMask | Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask); Gdk.WindowAttributesType attributes_mask = Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Colormap | Gdk.WindowAttributesType.Visual; GdkWindow = new Gdk.Window(ParentWindow, attributes, (int)attributes_mask); GdkWindow.UserData = Handle; Style = Style.Attach(GdkWindow); Style.SetBackground(GdkWindow, State); GdkWindow.SetBackPixmap(null, true); if (Child != null) { Child.ParentWindow = GdkWindow; } if (grip != null) { grip.ParentWindow = GdkWindow; } }
protected override void OnRealized() { IsRealized = true; HasWindow = false; Window = Parent.Window; Gdk.WindowAttr attributes = new Gdk.WindowAttr(); attributes.WindowType = Gdk.WindowType.Child; attributes.X = Allocation.X; attributes.Y = Allocation.Y; attributes.Width = Allocation.Width; attributes.Height = Allocation.Height; attributes.Wclass = Gdk.WindowWindowClass.InputOnly; attributes.EventMask = (int)( Gdk.EventMask.PointerMotionMask | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask | Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.ScrollMask | Gdk.EventMask.ExposureMask); Gdk.WindowAttributesType attributes_mask = Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Wmclass; event_window = new Gdk.Window(Window, attributes, attributes_mask); event_window.UserData = Handle; //TODO stylecontext is set from path and path come from name so must inherit but need to be checked! //Style = Gtk.Rc.GetStyleByPaths (Settings, "*.GtkEntry", "*.GtkEntry", GType); base.OnRealized(); }
public Window(Gdk.Window parent, Gdk.WindowAttr attributes, Gdk.WindowAttributesType attributes_mask) : this(parent, attributes, (int)attributes_mask) { }
public static Cairo.Surface Realize(Widget widget) { IntPtr dpy = gdk_x11_get_default_xdisplay(); int scr = gdk_x11_get_default_screen(); DrawableFormat template = new DrawableFormat(); template.Color = new ColorFormat(); FormatMask mask = FormatMask.None; //template.Doublebuffer = doublebuffer; //mask |= FormatMask.Doublebuffer; IntPtr dformat = GlitzAPI.glitz_glx_find_window_format(dpy, scr, mask, ref template, 0); if (dformat == IntPtr.Zero) { throw new Exception("Could not find a usable GL visual"); } IntPtr vinfo = GlitzAPI.glitz_glx_get_visual_info_from_format(dpy, scr, dformat); widget.DoubleBuffered = false; Gdk.WindowAttr attributes = new Gdk.WindowAttr(); attributes.Mask = widget.Events | (Gdk.EventMask.ExposureMask | Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.StructureMask); //attributes.X = widget.Allocation.X; //attributes.Y = widget.Allocation.Y; attributes.X = 0; attributes.Y = 0; attributes.Width = 100; attributes.Height = 100; attributes.Wclass = Gdk.WindowClass.InputOutput; attributes.Visual = new Gdk.Visual(gdkx_visual_get(XVisualIDFromVisual(vinfo))); attributes.Colormap = new Gdk.Colormap(attributes.Visual, true); attributes.WindowType = Gdk.WindowType.Child; Gdk.WindowAttributesType attributes_mask = Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Visual | Gdk.WindowAttributesType.Colormap; widget.GdkWindow = new Gdk.Window(widget.ParentWindow, attributes, attributes_mask); widget.GdkWindow.UserData = widget.Handle; uint xid = gdk_x11_drawable_get_xid(widget.GdkWindow.Handle); attributes.Width = 100; attributes.Height = 100; IntPtr glitz_drawable = GlitzAPI.glitz_glx_create_drawable_for_window(dpy, scr, dformat, xid, (uint)attributes.Width, (uint)attributes.Height); ggd = new NDesk.Glitz.Drawable(glitz_drawable); IntPtr glitz_format = ggd.FindStandardFormat(FormatName.ARGB32); ggs = new NDesk.Glitz.Surface(ggd, glitz_format, (uint)attributes.Width, (uint)attributes.Height, 0, IntPtr.Zero); Console.WriteLine(ggd.Features); ggs.Attach(ggd, doublebuffer ? DrawableBuffer.BackColor : DrawableBuffer.FrontColor); //GlitzAPI.glitz_drawable_destroy (glitz_drawable); GlitzSurface gs = new GlitzSurface(ggs.Handle); return(gs); }