static void Insensitive_Unrealized(object obj, EventArgs args)
 {
     Gdk.Window win = (Gdk.Window)map[obj];
     win.Destroy();
     map.Remove(obj);
     map.Remove(win);
 }
Example #2
0
        public static void AddFault(Stetic.Wrapper.Widget owner, object faultId,
                                    Gtk.Orientation orientation,
                                    int x, int y, int width, int height)
        {
            Gtk.Widget widget = owner.Wrapped;
            if (!widget.IsRealized)
            {
                return;
            }

            Gdk.Window win = NewWindow(widget, Gdk.WindowClass.InputOnly);
            win.MoveResize(x, y, width, height);

            Hashtable widgetFaults = faultGroups[widget] as Hashtable;

            if (widgetFaults == null)
            {
                faultGroups[widget]      = widgetFaults = new Hashtable();
                widget.Destroyed        += FaultWidgetDestroyed;
                widget.DragMotion       += FaultDragMotion;
                widget.DragLeave        += FaultDragLeave;
                widget.DragDrop         += FaultDragDrop;
                widget.DragDataReceived += FaultDragDataReceived;
                DND.DestSet(widget, false);
            }
            widgetFaults[win] = new Fault(owner, faultId, orientation, win);
        }
Example #3
0
        /// <summary>
        /// Take screenshot and save it as PNG image to defined directory
        /// </summary>
        public void takeSnapShot()
        {
            Gdk.Window window = Gdk.Global.DefaultRootWindow;

            if (window != null)
            {
                Gdk.Pixbuf pixBuf = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, false, 8, window.Screen.Width, window.Screen.Height);
                pixBuf.GetFromDrawable(window, Gdk.Colormap.System, 0, 0, 0, 0, window.Screen.Width, window.Screen.Height);

                var now = DateTime.Now;

                // 2012-12-28
                var dayPath = String.Format("{0:0000}-{1:00}-{2:00}", now.Year, now.Month, now.Day);

                // 235911,213
                var fileName = String.Format("{0:00}{1:00}{2:00},{3}", now.Hour, now.Minute, now.Second, now.Millisecond);

                var savePath = settings.directory + "\\" + dayPath;

                if (!Directory.Exists(savePath))
                {
                    // Generate directory
                    Directory.CreateDirectory(savePath);
                }

                savePath += "\\" + fileName + ".png";

                // Save screenshot
                pixBuf.Save(savePath, "png");

                lastFileName = savePath;
            }
        }
Example #4
0
            protected override bool OnExposeEvent(Gdk.EventExpose evnt)
            {
                // The Entry's GdkWindow is the top level window onto which
                // the frame is drawn; the actual text entry is drawn into a
                // separate window, so we can ensure that for themes that don't
                // respect HasFrame, we never ever allow the base frame drawing
                // to happen
                if (evnt.Window == GdkWindow)
                {
                    return(true);
                }

                bool ret = base.OnExposeEvent(evnt);

                if (text_gc == null || evnt.Window != text_window)
                {
                    text_window = evnt.Window;
                    RefreshGC();
                }

                if (Text.Length > 0 || HasFocus || parent.EmptyMessage == null)
                {
                    return(ret);
                }

                int width, height;

                layout.SetMarkup(parent.EmptyMessage);
                layout.GetPixelSize(out width, out height);
                evnt.Window.DrawLayout(text_gc, 2, (SizeRequest().Height - height) / 2, layout);

                return(ret);
            }
Example #5
0
        void SendButtonEvent(Widget target, Gdk.EventType eventType, double x, double y, Gdk.ModifierType state, uint button)
        {
            Gdk.Window win = target.GdkWindow;

            int rx, ry;

            win.GetRootOrigin(out rx, out ry);

            var nativeEvent = new NativeEventButtonStruct {
                type       = eventType,
                send_event = 1,
                window     = win.Handle,
                state      = (uint)state,
                button     = button,
                x          = x,
                y          = y,
                axes       = IntPtr.Zero,
                device     = IntPtr.Zero,
                time       = Global.CurrentEventTime,
                x_root     = x + rx,
                y_root     = y + ry
            };

            IntPtr ptr = GLib.Marshaller.StructureToPtrAlloc(nativeEvent);

            try {
                Gdk.EventHelper.Put(new Gdk.EventButton(ptr));
            } finally {
                Marshal.FreeHGlobal(ptr);
            }
        }
Example #6
0
        public static Gdk.DragContext BeginFromPoint(Gdk.Window window, Gdk.Device device, GLib.List targets, int x_root, int y_root)
        {
            IntPtr raw_ret = gdk_drag_begin_from_point(window == null ? IntPtr.Zero : window.Handle, device == null ? IntPtr.Zero : device.Handle, targets == null ? IntPtr.Zero : targets.Handle, x_root, y_root);

            Gdk.DragContext ret = GLib.Object.GetObject(raw_ret) as Gdk.DragContext;
            return(ret);
        }
Example #7
0
        /// <summary>
        /// Export the map to an image.
        /// </summary>
        public Image Export()
        {
            // Create a Bitmap and draw the DataGridView on it.
            int width;
            int height;

            if (ProcessUtilities.CurrentOS.IsWindows)
            {
                // Give the browser half a second to run all its scripts
                // It would be better if we could tap into the browser's Javascript engine
                // and see whether loading of the map was complete, but my attempts to do
                // so were not entirely successful.
                Stopwatch watch = new Stopwatch();
                watch.Start();
                while (watch.ElapsedMilliseconds < 500)
                {
                    Gtk.Application.RunIteration();
                }
            }
            Gdk.Window gridWindow = MainWidget.GdkWindow;
            gridWindow.GetSize(out width, out height);
            Gdk.Pixbuf   screenshot = Gdk.Pixbuf.FromDrawable(gridWindow, gridWindow.Colormap, 0, 0, 0, 0, width, height);
            byte[]       buffer     = screenshot.SaveToBuffer("png");
            MemoryStream stream     = new MemoryStream(buffer);

            System.Drawing.Bitmap bitmap = new Bitmap(stream);
            return(bitmap);
        }
Example #8
0
        public static bool Motion(Gdk.DragContext context, Gdk.Window dest_window, Gdk.DragProtocol protocol, int x_root, int y_root, Gdk.DragAction suggested_action, Gdk.DragAction possible_actions, uint time_)
        {
            bool raw_ret = gdk_drag_motion(context == null ? IntPtr.Zero : context.Handle, dest_window == null ? IntPtr.Zero : dest_window.Handle, (int)protocol, x_root, y_root, (int)suggested_action, (int)possible_actions, time_);
            bool ret     = raw_ret;

            return(ret);
        }
Example #9
0
        protected override void OnUnrealized()
        {
            bin_window.Destroy();
            bin_window = null;

            base.OnUnrealized();
        }
Example #10
0
        public static Cairo.Context Create(Gdk.Window window)
        {
            IntPtr raw_ret = gdk_cairo_create(window == null ? IntPtr.Zero : window.Handle);

            Cairo.Context ret = new Cairo.Context(raw_ret, true);
            return(ret);
        }
Example #11
0
        void UpdateHighlight()
        {
            Gdk.Window win = this.GdkWindow;

            Cairo.Context g = Gdk.CairoHelper.Create(win);

            int x, y, w, h, d;

            win.GetGeometry(out x, out y, out w, out h, out d);

            g.Scale(w, h);
            g.LineWidth = (1.0 / freqs.Length) * 0.6;

            if (previousHighlight != -1)
            {
                /*int start=previousHighlight-1;
                 * int end=previousHighlight+1;
                 * if (start<0) start=0;
                 * if (end>=barStart.Length) end=barStart.Length-1;*/
                g.Color = new Color(0.0, 0.0, 0.0);
                //for(int i=start; i<=end; i++)
                DrawBar(g, previousHighlight);
            }

            if (currentHighlight != -1)
            {
                g.Color = new Color(1.0, 0.0, 0.0);
                DrawBar(g, currentHighlight);
            }
        }
Example #12
0
        // Redraw vertical gridlines for the exposed area.
        void DrawVerticalGrid(Gdk.Window win, Gdk.Rectangle rect)
        {
            SampleQueue data = debugManager.PowerData;

            if (data == null)
            {
                return;
            }

            int usPerPx = scale * data.Period;
            int t       = rect.X * usPerPx;

            // Find the first time divison before the exposed area
            t -= t % hSpacingUs;

            for (;;)
            {
                int x = t / usPerPx;

                if (x >= rect.X + rect.Width)
                {
                    break;
                }

                win.DrawLine(gcGrid, x, 0, x, allocation.Height - 1);
                t += hSpacingUs;
            }
        }
Example #13
0
        public void Render(Player player, List <Ball> balls, List <Monster> monsters)
        {
            Gdk.Window canvas = area.GdkWindow;
            if (canvas != null)
            {
                using (Cairo.Context context = Gdk.CairoHelper.Create(canvas)) {
                    canvas.BeginPaintRegion(new Gdk.Region());
                    context.SetSourceSurface(background, 0, 0);
                    context.Paint();

                    foreach (Field field in player.Trail)
                    {
                        paintTrail(context, field.X * fieldSize, field.Y * fieldSize);
                    }

                    foreach (Ball ball in balls)
                    {
                        context.SetSourceRGB(1, 0, 0);
                        paintCircle(context, ball.X, ball.Y);
                    }

                    foreach (Monster monster in monsters)
                    {
                        paintMonster(context, monster);
                    }

                    context.SetSourceRGB(0, 0, 1);
                    paintPlayer(context, player);

                    canvas.EndPaint();
                }
            }
        }
Example #14
0
        static Gdk.Window NewWindow(Gtk.Widget parent, Gdk.WindowClass wclass)
        {
            Gdk.WindowAttr           attributes;
            Gdk.WindowAttributesType attributesMask;
            Gdk.Window win;

            attributes            = new Gdk.WindowAttr();
            attributes.WindowType = Gdk.WindowType.Child;
            attributes.Wclass     = wclass;
            attributes.Visual     = parent.Visual;
            attributes.Colormap   = parent.Colormap;
            attributes.Mask       = (Gdk.EventMask.ButtonPressMask |
                                     Gdk.EventMask.ButtonMotionMask |
                                     Gdk.EventMask.ButtonReleaseMask |
                                     Gdk.EventMask.ExposureMask |
                                     Gdk.EventMask.EnterNotifyMask |
                                     Gdk.EventMask.LeaveNotifyMask);

            attributesMask =
                Gdk.WindowAttributesType.Visual |
                Gdk.WindowAttributesType.Colormap;

            win          = new Gdk.Window(parent.GdkWindow, attributes, attributesMask);
            win.UserData = parent.Handle;

            if (wclass == Gdk.WindowClass.InputOutput)
            {
                parent.Style.Attach(win);
            }

            return(win);
        }
Example #15
0
        public static Gdk.DragContext BeginForDevice(Gdk.Window window, Gdk.Device device, GLib.List targets)
        {
            IntPtr raw_ret = gdk_drag_begin_for_device(window == null ? IntPtr.Zero : window.Handle, device == null ? IntPtr.Zero : device.Handle, targets == null ? IntPtr.Zero : targets.Handle);

            Gdk.DragContext ret = GLib.Object.GetObject(raw_ret) as Gdk.DragContext;
            return(ret);
        }
Example #16
0
        public static byte Change(Gdk.Window window, Gdk.Atom property, Gdk.Atom type, int format, Gdk.PropMode mode, int nelements)
        {
            byte data;

            gdk_property_change(window == null ? IntPtr.Zero : window.Handle, property == null ? IntPtr.Zero : property.Handle, type == null ? IntPtr.Zero : type.Handle, format, (int)mode, out data, nelements);
            return(data);
        }
Example #17
0
        // Looks at all tags covering the position (x, y) in the text view,
        // and if one of them is a link, change the cursor to the "hands" cursor
        // typically used by web browsers.
        void SetCursorIfAppropriate(TextView view, int x, int y)
        {
            bool     hovering = false;
            TextIter iter     = view.GetIterAtLocation(x, y);

            foreach (TextTag tag in iter.Tags)
            {
                if (tag_pages [tag] is int)
                {
                    hovering = true;
                    break;
                }
            }

            if (hovering != hoveringOverLink)
            {
                Gdk.Window window = view.GetWindow(Gtk.TextWindowType.Text);

                hoveringOverLink = hovering;
                if (hoveringOverLink)
                {
                    window.Cursor = handCursor;
                }
                else
                {
                    window.Cursor = regularCursor;
                }
            }
        }
Example #18
0
        Rectangle WindowPositionAndSize(Gdk.Window window)
        {
            int x, y, width, height;

            window.GetPosition(out x, out y);
            window.GetSize(out width, out height);
            return(new Rectangle(x, y, width, height));
        }
Example #19
0
        public Gdk.GrabStatus Grab(Gdk.Window window, Gdk.SeatCapabilities capabilities, bool owner_events, Gdk.Cursor cursor, Gdk.Event evnt, Gdk.SeatGrabPrepareFunc prepare_func)
        {
            GdkSharp.SeatGrabPrepareFuncWrapper prepare_func_wrapper = new GdkSharp.SeatGrabPrepareFuncWrapper(prepare_func);
            int raw_ret = gdk_seat_grab(Handle, window == null ? IntPtr.Zero : window.Handle, (int)capabilities, owner_events, cursor == null ? IntPtr.Zero : cursor.Handle, evnt == null ? IntPtr.Zero : evnt.Handle, prepare_func_wrapper.NativeDelegate, IntPtr.Zero);

            Gdk.GrabStatus ret = (Gdk.GrabStatus)raw_ret;
            return(ret);
        }
Example #20
0
 public CairoDrawer(Gdk.Window window, bool antialias)
 {
     context = Gdk.CairoHelper.Create(window);
     if (!antialias)
     {
         context.Antialias = Antialias.None;
     }
 }
Example #21
0
 public Fault(Stetic.Wrapper.Widget owner, object id,
              Gtk.Orientation orientation, Gdk.Window window)
 {
     Owner       = owner;
     Id          = id;
     Orientation = orientation;
     Window      = window;
 }
Example #22
0
 static void Insensitive_SizeAllocate(object obj, Gtk.SizeAllocatedArgs args)
 {
     Gdk.Window win = (Gdk.Window)map[obj];
     if (win != null)
     {
         win.MoveResize(args.Allocation);
     }
 }
Example #23
0
 public SystemDrawer(Gdk.Window window, bool antialias)
 {
     graphics = Gtk.DotNet.Graphics.FromDrawable(window);
     if (antialias)
     {
         graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
     }
 }
Example #24
0
        private void UpdateEventButton(Gdk.EventButton evnt, Gdk.Window window, double x, double y)
        {
            int x_offset = IntPtr.Size * 2 + 8;

            UpdateEventButtonWindow(evnt, window);
            MarshalWriteDouble(evnt.Handle, x_offset, x);
            MarshalWriteDouble(evnt.Handle, x_offset + 8, y);
        }
Example #25
0
        public static bool Get(Gdk.Window window, Gdk.Atom property, Gdk.Atom type, ulong offset, ulong length, bool pdelete, out int[] data)
        {
            IntPtr actual_property_type, raw_data;
            int    actual_length, format;
            bool   ret = gdk_property_get(window == null ? IntPtr.Zero : window.Handle, property == null ? IntPtr.Zero : property.Handle, type == null ? IntPtr.Zero : type.Handle, new UIntPtr(offset), new UIntPtr(length), pdelete, out actual_property_type, out format, out actual_length, out raw_data);

            if (ret)
            {
                try {
                    int block_size;
                    if (format == 32)                       // data returned in blocks the size of a C long
                    {
#if WIN64LONGS
                        block_size = sizeof(int);
#else
                        block_size = IntPtr.Size;
#endif
                    }
                    else if (format == 8 || format == 16)
                    {
                        block_size = format;
                    }
                    else
                    {
                        throw new NotSupportedException(String.Format("Unable to read properties in {0}-bit format", format));
                    }

                    int size = actual_length / block_size;
                    data = new int [size];
                    for (int idx = 0; idx < size; idx++)
                    {
                        IntPtr elem_ptr = new IntPtr(raw_data.ToInt64() + idx * block_size);
                        switch (format)
                        {
                        case 8:
                            data [idx] = Marshal.ReadByte(elem_ptr);
                            break;

                        case 16:
                            data [idx] = Marshal.ReadInt16(elem_ptr);
                            break;

                        case 32:
                            data [idx] = Marshal.ReadInt32(elem_ptr);
                            break;
                        }
                    }
                } finally {
                    GLib.Marshaller.Free(raw_data);
                }
            }
            else
            {
                data = null;
            }

            return(ret);
        }
Example #26
0
 public static Gdk.GC GetDarkenedGC(Gdk.Window window,
                                    Gdk.Color color,
                                    int darken_count)
 {
     DarkenColor(ref color, darken_count);
     Gdk.GC gc = new Gdk.GC(window);
     gc.RgbFgColor = color;
     return(gc);
 }
Example #27
0
        public static void FindWindowForScreen(Gdk.DragContext context, Gdk.Window drag_window, Gdk.Screen screen, int x_root, int y_root, out Gdk.Window dest_window, out Gdk.DragProtocol protocol)
        {
            IntPtr native_dest_window;
            int    native_protocol;

            gdk_drag_find_window_for_screen(context == null ? IntPtr.Zero : context.Handle, drag_window == null ? IntPtr.Zero : drag_window.Handle, screen == null ? IntPtr.Zero : screen.Handle, x_root, y_root, out native_dest_window, out native_protocol);
            dest_window = GLib.Object.GetObject(native_dest_window) as Gdk.Window;
            protocol    = (Gdk.DragProtocol)native_protocol;
        }
Example #28
0
 static void DestroySplitter()
 {
     if (splitter != null)
     {
         splitter.Hide();
         splitter.Destroy();
         splitter = null;
     }
 }
Example #29
0
        public static Gdk.Point ToWindowCoordinates(Gtk.Widget widget, Gdk.Window w, int x, int y)
        {
            int ox, oy;

            w.GetOrigin(out ox, out oy);
            ox += widget.Allocation.X;
            oy += widget.Allocation.Y;
            return(new Gdk.Point(x - ox, y - oy));
        }
Example #30
0
        /// <summary>
        /// Draws the slider arrows on both sides of the control.
        /// </summary>
        /// <param name="position">position value of the slider, lowest being at the bottom.  The range
        /// is between 0 and the controls height-9.  The values will be adjusted if too large/small</param>
        /// <param name="Unconditional">If Unconditional is true, the slider is drawn, otherwise some logic
        /// is performed to determine is drawing is really neccessary.</param>
        private void DrawSlider(Gdk.Window g, int position, bool Unconditional)
        {
            if (position < 0)
            {
                position = 0;
            }
            if (position > this.Allocation.Height - 9)
            {
                position = this.Allocation.Height - 9;
            }

            if (m_iMarker_Start_Y == position && !Unconditional)                //	If the marker position hasn't changed
            {
                return;                                                         //	since the last time it was drawn and we don't HAVE to redraw
            }
            //	then exit procedure

            m_iMarker_Start_Y = position;               //	Update the controls marker position

            this.ClearSlider(g);                        //	Remove old slider

            Gdk.GC gcfill = new Gdk.GC(g);
            //	Same gray color Photoshop uses
            gcfill.RgbFgColor = GraphUtil.gdkColorFromWinForms(Color.FromArgb(116, 114, 106));


            Gdk.GC gcborder = new Gdk.GC(g);
            gcfill.RgbFgColor = GraphUtil.gdkColorFromWinForms(Color.White);
            //	Same gray color Photoshop uses
            //Console.WriteLine( "position="+position );

            Gdk.Point[] arrow = new Gdk.Point[7];               //	 GGG
            arrow[0] = new Gdk.Point(1, position);              //	G   G
            arrow[1] = new Gdk.Point(3, position);              //	G    G
            arrow[2] = new Gdk.Point(7, position + 4);          //	G     G
            arrow[3] = new Gdk.Point(3, position + 8);          //	G      G
            arrow[4] = new Gdk.Point(1, position + 8);          //	G     G
            arrow[5] = new Gdk.Point(0, position + 7);          //	G    G
            arrow[6] = new Gdk.Point(0, position + 1);          //	G   G
            //	 GGG
            g.DrawPolygon(gcfill, true, arrow);                 //	Fill left arrow with white
            g.DrawPolygon(gcborder, false, arrow);              //	Draw left arrow border with gray

            //	    GGG
            arrow[0] = new Gdk.Point(this.Allocation.Width - 2, position);                      //	   G   G
            arrow[1] = new Gdk.Point(this.Allocation.Width - 4, position);                      //	  G    G
            arrow[2] = new Gdk.Point(this.Allocation.Width - 8, position + 4);                  //	 G     G
            arrow[3] = new Gdk.Point(this.Allocation.Width - 4, position + 8);                  //	G      G
            arrow[4] = new Gdk.Point(this.Allocation.Width - 2, position + 8);                  //	 G     G
            arrow[5] = new Gdk.Point(this.Allocation.Width - 1, position + 7);                  //	  G    G
            arrow[6] = new Gdk.Point(this.Allocation.Width - 1, position + 1);                  //	   G   G
            //	    GGG

            g.DrawPolygon(gcfill, true, arrow);                 //	Fill right arrow with white
            g.DrawPolygon(gcborder, false, arrow);              //	Draw right arrow border with gray
        }
Example #31
0
 public X11KeyboardHook()
 {
     if (Interlocked.Increment(ref count) == 1) {
         Gtk.Application.Init();
         Application.AddMessageFilter(new Filter());
     }
     Console.WriteLine (Marshal.SizeOf(typeof(IntPtr)));
     window = new Gdk.Window(gdk_get_default_root_window());
     window.AddFilter(FilterFunction);
 }
Example #32
0
        /// <summary>
        /// Creates a cairo surface that targets a platform-specific resource.
        /// </summary>
        /// <param name="handle">The platform-specific handle.</param>
        /// <returns>A surface wrapped in an <see cref="IDrawingContext"/>.</returns>
        protected override IDrawingContext CreateDrawingContext(IPlatformHandle handle)
        {
            switch (handle.HandleDescriptor)
            {
                case "RTB":
                    return new DrawingContext(_surface);
                case "GdkWindow":
                    if (_window == null)
                        _window = new Gdk.Window(handle.Handle);

                    return new DrawingContext(_window);
                default:
                    throw new NotSupportedException(string.Format(
                        "Don't know how to create a Cairo renderer from a '{0}' handle",
                        handle.HandleDescriptor));
            }
        }
		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);
		}
        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;
            }
        }
Example #35
0
            protected override bool OnExposeEvent(Gdk.EventExpose evnt)
            {
                // The Entry's GdkWindow is the top level window onto which
                // the frame is drawn; the actual text entry is drawn into a
                // separate window, so we can ensure that for themes that don't
                // respect HasFrame, we never ever allow the base frame drawing
                // to happen
                if(evnt.Window == GdkWindow) {
                    return true;
                }

                bool ret = base.OnExposeEvent(evnt);

                if(text_gc == null || evnt.Window != text_window) {
                    text_window = evnt.Window;
                    RefreshGC();
                }

                if(Text.Length > 0 || HasFocus || parent.EmptyMessage == null) {
                    return ret;
                }

                if (layout == null) {
                    layout = new Pango.Layout(PangoContext);
                    layout.FontDescription = PangoContext.FontDescription;
                }

                int width, height;
                layout.SetMarkup(parent.EmptyMessage);
                layout.GetPixelSize(out width, out height);
                evnt.Window.DrawLayout(text_gc, 2, (SizeRequest().Height - height) / 2, layout);

                return ret;
            }
Example #36
0
        protected override void OnUnrealized()
        {
            IsRealized = false;

            event_window.UserData = IntPtr.Zero;
            event_window.Destroy ();
            event_window = null;

            base.OnUnrealized ();
        }
Example #37
0
        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.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 DrawDescriptionEntryEventArgs(string description, Gdk.Window win)
 {
     Description = description;
     Window = win;
 }
Example #39
0
        protected override void OnUnrealized()
        {
            WidgetFlags &= ~WidgetFlags.Realized;

            event_window.UserData = IntPtr.Zero;
            Hyena.Gui.GtkWorkarounds.WindowDestroy (event_window);
            event_window = null;

            base.OnUnrealized ();
        }
        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;
        }
Example #41
0
File: DND.cs Project: mono/stetic
        static Gdk.Window NewWindow(Gtk.Widget parent, Gdk.WindowClass wclass)
        {
            Gdk.WindowAttr attributes;
            Gdk.WindowAttributesType attributesMask;
            Gdk.Window win;

            attributes = new Gdk.WindowAttr ();
            attributes.WindowType = Gdk.WindowType.Child;
            attributes.Wclass = wclass ;
            attributes.Visual = parent.Visual;
            attributes.Colormap = parent.Colormap;
            attributes.Mask = (Gdk.EventMask.ButtonPressMask |
                       Gdk.EventMask.ButtonMotionMask |
                       Gdk.EventMask.ButtonReleaseMask |
                       Gdk.EventMask.ExposureMask |
                       Gdk.EventMask.EnterNotifyMask |
                       Gdk.EventMask.LeaveNotifyMask);

            attributesMask =
                Gdk.WindowAttributesType.Visual |
                Gdk.WindowAttributesType.Colormap;

            win = new Gdk.Window (parent.GdkWindow, attributes, attributesMask);
            win.UserData = parent.Handle;

            if (wclass == Gdk.WindowClass.InputOutput)
                parent.Style.Attach (win);

            return win;
        }
        protected override void OnRealized()
        {
            base.OnRealized ();

            if (titleWindow == null) {
                Gdk.WindowAttr attributes = new Gdk.WindowAttr ();
                Gdk.Rectangle area = TitleArea;

                attributes.X = area.X;
                attributes.Y = area.Y;
                attributes.Width = area.Width;
                attributes.Height = area.Height;
                attributes.WindowType = Gdk.WindowType.Temp;
                attributes.Wclass = Gdk.WindowClass.InputOnly;
                attributes.OverrideRedirect = true;
                attributes.EventMask = (int) (Events |
                    Gdk.EventMask.ButtonPressMask |
                    Gdk.EventMask.ButtonReleaseMask |
                    Gdk.EventMask.ButtonMotionMask);

                titleWindow = new Gdk.Window (ParentWindow, attributes,
                    (int) (Gdk.WindowAttributesType.X |
                    Gdk.WindowAttributesType.Y |
                    Gdk.WindowAttributesType.Noredir));

                titleWindow.UserData = Handle;

                if (item.CantClose || item.CantIconify)
                    titleWindow.Cursor = null;
                else
                    titleWindow.Cursor = new Gdk.Cursor (Display, Gdk.CursorType.Hand2);
            }
        }
        protected override void OnUnrealized()
        {
            if (titleWindow != null) {
                titleWindow.UserData = IntPtr.Zero;
                titleWindow.Destroy ();
                titleWindow = null;
            }

            base.OnUnrealized ();
        }
Example #44
0
        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 ();
        }
		static void Insensitive_Realized (object obj, EventArgs args)
		{
			Gtk.Widget widget = (Gtk.Widget)obj;

			Gdk.WindowAttr attributes = new Gdk.WindowAttr ();
			attributes.WindowType = Gdk.WindowType.Child;
			attributes.Wclass = Gdk.WindowClass.InputOnly;
			attributes.Mask = Gdk.EventMask.ButtonPressMask;

			Gdk.Window win = new Gdk.Window (widget.GdkWindow, attributes, 0);
			win.UserData = invis.Handle;
			win.MoveResize (widget.Allocation);

			map[widget] = win;
			map[win] = widget;
		}
Example #46
0
        public static bool Get(Gdk.Window window, Gdk.Atom property, ulong offset, ulong length, bool pdelete, out Gdk.Window[] windows)
        {
            int[] raw_windows;
            if (!Get (window, property, Gdk.Atom.Intern ("WINDOW", false), offset, length, pdelete, out raw_windows)) {
                windows = null;
                return false;
            }

            windows = new Gdk.Window [raw_windows.GetLength (0)];
            for (int idx = 0; idx < raw_windows.GetLength (0); idx ++) {
                windows [idx] = Gdk.Window.ForeignNew ((uint) raw_windows [idx]);
            }
            return true;
        }
Example #47
0
File: DND.cs Project: mono/stetic
 static void DestroySplitter()
 {
     if (splitter != null) {
         splitter.Hide ();
         splitter.Destroy ();
         splitter = null;
     }
 }
Example #48
0
 public SurfaceReceiver(Gdk.Window window, Gdk.Pixbuf surface)
 {
     rfx = new Rfx();
     this.window = window;
     this.surface = surface;
 }
Example #49
0
File: DND.cs Project: mono/stetic
        static void FaultDragMotion(object obj, Gtk.DragMotionArgs args)
        {
            int wx, wy, width, height, depth;

            Gtk.Widget widget = (Gtk.Widget) obj;
            int px = args.X + widget.Allocation.X;
            int py = args.Y + widget.Allocation.Y;

            Fault fault = FindFault (px, py, widget);

            // If there's a splitter visible, and we're not currently dragging
            // in the fault that owns that splitter, hide it
            if (splitter != null && dragFault != fault)
                DestroySplitter ();

            if (dragFault != fault) {
                dragFault = fault;
                if (dragFault == null)
                    return;

                splitter = NewWindow (fault.Owner.Wrapped, Gdk.WindowClass.InputOutput);
                fault.Window.GetGeometry (out wx, out wy, out width, out height, out depth);
                if (fault.Orientation == Gtk.Orientation.Horizontal) {
                    splitter.MoveResize (wx, wy + height / 2 - FaultOverlap,
                                 width, 2 * FaultOverlap);
                } else {
                    splitter.MoveResize (wx + width / 2 - FaultOverlap, wy,
                                 2 * FaultOverlap, height);
                }
                splitter.ShowUnraised ();
                fault.Window.Lower ();
            } else if (dragFault == null)
                return;

            Gdk.Drag.Status (args.Context, Gdk.DragAction.Move, args.Time);
            args.RetVal = true;
        }
Example #50
0
        protected override void OnRealized()
        {
            SetFlag (Gtk.WidgetFlags.Realized);

            Gdk.WindowAttr attributes = new Gdk.WindowAttr {
                                 WindowType = Gdk.WindowType.Child,
                                 X = Allocation.X,
                                 Y = Allocation.Y,
                                 Width = Allocation.Width,
                                 Height = Allocation.Height,
                                 Wclass = Gdk.WindowClass.InputOutput,
                                 Visual = this.Visual,
                                 Colormap = this.Colormap,
                                 Mask = Gdk.EventMask.VisibilityNotifyMask };
            GdkWindow = new Gdk.Window (ParentWindow, attributes,
                            Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Visual | Gdk.WindowAttributesType.Colormap);

            GdkWindow.SetBackPixmap (null, false);
            GdkWindow.UserData = Handle;

            attributes = new Gdk.WindowAttr {
                                 WindowType = Gdk.WindowType.Child,
                                 X = (int)-Hadjustment.Value,
                                 Y = (int)-Vadjustment.Value,
                                 Width = (int)Math.Max (width, Allocation.Width),
                                 Height = (int)Math.Max (height, Allocation.Height),
                                 Wclass = Gdk.WindowClass.InputOutput,
                                 Visual = this.Visual,
                                 Colormap = this.Colormap,
                                 Mask = Gdk.EventMask.ExposureMask | Gdk.EventMask.ScrollMask | this.Events };
            bin_window = new Gdk.Window (GdkWindow, attributes,
                             Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Visual | Gdk.WindowAttributesType.Colormap);
            bin_window.UserData = Handle;

            Style.Attach (GdkWindow);
            Style.SetBackground (bin_window, Gtk.StateType.Normal);

            foreach (var child in children) {
                child.Widget.ParentWindow = bin_window;
            }
        }
Example #51
0
File: DND.cs Project: mono/stetic
            public Fault(Stetic.Wrapper.Widget owner, object id,
				      Gtk.Orientation orientation, Gdk.Window window)
            {
                Owner = owner;
                Id = id;
                Orientation = orientation;
                Window = window;
            }
Example #52
0
        protected override void OnUnrealized()
        {
            bin_window.Destroy ();
            bin_window = null;

            base.OnUnrealized ();
        }