Exemple #1
0
 protected sealed override void OnSetScreenRegion(Gdk.Screen screen, Gdk.Rectangle region)
 {
     foreach (Wnck.Window w in ManagedWindows)
     {
         w.SetIconGeometry(region.X, region.Y, region.Width, region.Height);
     }
 }
 public override void SetScreenRegion(Gdk.Screen screen, Gdk.Rectangle region)
 {
     // need to ensure every proxied item gets this update
     foreach (AbstractDockItem adi in Provider.Items)
     {
         adi.SetScreenRegion(screen, region);
     }
 }
Exemple #3
0
 public static bool SupportsHint(Screen screen, string name)
 {
     try {
         Atom atom = Atom.Intern (name, false);
         return gdk_x11_screen_supports_net_wm_hint (screen.Handle, atom.Handle);
     } catch {
         return false;
     }
 }
Exemple #4
0
 public MainWindow() : base(Gtk.WindowType.Toplevel)
 {
     Build();
     Gdk.Window mwin       = this.GdkWindow;
     Gdk.Screen mainScreen = this.Screen;
     this.HeightRequest     = mainScreen.Height;
     this.WidthRequest      = mainScreen.Width;
     this.btnLogon.Clicked += btnLogon_Clicked;
     this.entryPassword.ActivatesDefault = true;
 }
        public virtual void SetScreenRegion(Gdk.Screen screen, Gdk.Rectangle region)
        {
            try {
                OnSetScreenRegion(screen, region);
            } catch (Exception e) {
                Log <AbstractDockItem> .Error(e.Message);

                Log <AbstractDockItem> .Debug(e.StackTrace);
            }
        }
Exemple #6
0
        internal AutohideManager(Gdk.Screen screen)
        {
            pid = System.Diagnostics.Process.GetCurrentProcess().Id;

            tracker     = CursorTracker.ForDisplay(screen.Display);
            this.screen = Wnck.Screen.Get(screen.Number);

            tracker.CursorPositionChanged   += HandleCursorPositionChanged;
            this.screen.ActiveWindowChanged += HandleActiveWindowChanged;
            this.screen.WindowOpened        += HandleWindowOpened;
            this.screen.WindowClosed        += HandleWindowClosed;
        }
Exemple #7
0
 public static Visual GetRgbaVisual (Screen screen)
 {
     try {
         IntPtr raw_ret = gdk_screen_get_rgba_visual (screen.Handle);
         Gdk.Visual ret = GLib.Object.GetObject (raw_ret) as Gdk.Visual;
         return ret;
     } catch {
         Gdk.Visual visual = Gdk.Visual.GetBestWithDepth (32);
         if (visual != null) {
             return visual;
         }
     }
     return null;
 }
Exemple #8
0
        protected override void OnScreenChanged(Gdk.Screen previous_screen)
        {
            Colormap colormap = this.Screen.RgbaColormap;

            if (colormap == null)
            {
                colormap          = this.Screen.RgbColormap;
                this.supportAlpha = false;
            }
            else
            {
                this.supportAlpha = true;
            }
            this.Colormap = colormap;
            base.OnScreenChanged(previous_screen);
        }
Exemple #9
0
        public static Colormap GetRgbaColormap (Screen screen)
        {
            try {
                IntPtr raw_ret = gdk_screen_get_rgba_colormap (screen.Handle);
                Gdk.Colormap ret = GLib.Object.GetObject(raw_ret) as Gdk.Colormap;
                return ret;
            } catch {
                Gdk.Visual visual = Gdk.Visual.GetBestWithDepth (32);
                if (visual != null) {
                    Gdk.Colormap cmap = new Gdk.Colormap (visual, false);
                    return cmap;
                }
            }

            return null;
        }
Exemple #10
0
        public void Position(Gdk.Window eventWindow)
        {
            int x, y;
            int widget_x, widget_y;
            int widget_height, widget_width;

            Realize();

            Gdk.Window widget_window = eventWindow;
            Gdk.Screen widget_screen = widget_window.Screen;

            Gtk.Requisition popup_req;

            widget_window.GetOrigin(out widget_x, out widget_y);
            widget_width  = widget_window.Width;
            widget_height = widget_window.Height;

            popup_req = Requisition;

            if (widget_x + widget_width > widget_screen.Width)
            {
                x = widget_screen.Width - popup_req.Width;
            }
            else if (widget_x + widget_width - popup_req.Width < 0)
            {
                x = 0;
            }
            else
            {
                x = widget_x + widget_width - popup_req.Width;
            }

            if (widget_y + widget_height + popup_req.Height > widget_screen.Height)
            {
                y = widget_screen.Height - popup_req.Height;
            }
            else if (widget_y + widget_height < 0)
            {
                y = 0;
            }
            else
            {
                y = widget_y + widget_height;
            }

            Move(x, y);
        }
Exemple #11
0
        protected override void OnScreenChanged(Gdk.Screen previous_screen)
        {
            // To check if the display supports alpha channels, get the colormap
            var colormap = this.Screen.RgbaColormap;

            if (colormap == null)
            {
                colormap     = this.Screen.RgbColormap;
                supportAlpha = false;
            }
            else
            {
                supportAlpha = true;
            }
            this.Colormap = colormap;
            base.OnScreenChanged(previous_screen);
        }
    static public Pixbuf LoadFromScreen(Gdk.Window win)
    {
        Gdk.Screen screen  = win.Screen;
        Drawable   d       = screen.RootWindow;
        int        monitor = screen.GetMonitorAtWindow(win);

        Gdk.Rectangle geom = screen.GetMonitorGeometry(monitor);

        //
        // We use the screen width and height because that reflects
        // the current resolution, the RootWindow can actually be different.
        //

        Pixbuf buf = new Pixbuf(Colorspace.Rgb, false, 8, geom.Width, geom.Height);

        return(buf.GetFromDrawable(d,
                                   d.Colormap, geom.X, geom.Y, 0, 0,
                                   geom.Width, geom.Height));
    }
Exemple #13
0
        void Update(Gdk.Screen screen, int x, int y, Gdk.ModifierType mod)
        {
            last_update = DateTime.UtcNow;

            if (!Enabled)
            {
                return;
            }

            Gdk.Point lastPostion = Cursor;

            Cursor   = new Gdk.Point(x, y);
            Modifier = mod;
            Screen   = screen;

            if (lastPostion != Cursor)
            {
                OnCursorPositionChanged(lastPostion);
            }
        }
Exemple #14
0
 public static void ShowHelp(string filename, string link_id, Gdk.Screen screen, Gtk.Window parent)
 {
     try {
         Gnome.Help.DisplayDesktopOnScreen(
             Gnome.Program.Get(),
             FSpot.Global.HelpDirectory,
             filename,
             link_id,
             screen);
     } catch {
         string message = Mono.Unix.Catalog.GetString("The \"F-Spot Manual\" could " +
                                                      "not be found.  Please verify " +
                                                      "that your installation has been " +
                                                      "completed successfully.");
         HigMessageDialog dialog = new HigMessageDialog(parent,
                                                        Gtk.DialogFlags.DestroyWithParent,
                                                        Gtk.MessageType.Error,
                                                        Gtk.ButtonsType.Ok,
                                                        Mono.Unix.Catalog.GetString("Help not found"),
                                                        message);
         dialog.Run();
         dialog.Destroy();
     }
 }
 public static Visual LookupVisual(Screen screen, uint visualid)
 {
     return (Gdk.Visual) GLib.Object.GetObject (gdk_x11_screen_lookup_visual (screen.Handle, visualid));
 }
Exemple #16
0
        public FullScreenView(IBrowsableCollection collection, Gtk.Window parent) : base("Full Screen Mode")
        {
            //going fullscreen on the same screen the parent window
            Gdk.Screen screen  = Screen;
            int        monitor = screen.GetMonitorAtWindow(parent.GdkWindow);

            Gdk.Rectangle bounds = screen.GetMonitorGeometry(monitor);
            Move(bounds.X, bounds.Y);

            string style = "style \"test\" {\n" +
                           "GtkToolbar::shadow_type = GTK_SHADOW_NONE\n" +
                           "}\n" +
                           "class \"GtkToolbar\" style \"test\"";

            Gtk.Rc.ParseString(style);

            Name = "FullscreenContainer";
            try {
                //scroll = new Gtk.ScrolledWindow (null, null);
                actions = new ActionGroup("joe");

                actions.Add(new[] {
                    new ActionEntry(HideToolbar, Stock.Close, Strings.Hide, null, Strings.HideToolbar, HideToolbarAction)
                });

                actions.Add(new[] {
                    new ToggleActionEntry(Info, Stock.Info, Strings.Info, null, Strings.ImageInformation, InfoAction, false)
                });

                var exit_full_screen = new Gtk.Action(ExitFullScreen, Strings.ExitFullscreen, null, null)
                {
                    IconName = "view-restore"
                };
                exit_full_screen.Activated += ExitAction;
                actions.Add(exit_full_screen);

                var slide_show = new Gtk.Action(SlideShow, Strings.Slideshow, Strings.StartSlideshow, null)
                {
                    IconName = "media-playback-start"
                };
                slide_show.Activated += SlideShowAction;
                actions.Add(slide_show);

                new WindowOpacityFader(this, 1.0, 600);
                notebook = new Notebook {
                    ShowBorder = false,
                    ShowTabs   = false
                };
                notebook.Show();

                scroll = new ScrolledView();
                scroll.ScrolledWindow.SetPolicy(PolicyType.Never, PolicyType.Never);
                View = new PhotoImageView(collection);
                // FIXME this should be handled by the new style setting code
                View.ModifyBg(Gtk.StateType.Normal, this.Style.Black);
                Add(notebook);
                View.Show();
                View.MotionNotifyEvent += HandleViewMotion;
                View.PointerMode        = PointerMode.Scroll;

                scroll.ScrolledWindow.Add(View);

                var tbar = new Toolbar {
                    ToolbarStyle = Gtk.ToolbarStyle.BothHoriz,

                    ShowArrow   = false,
                    BorderWidth = 15
                };

                var t_item = actions[ExitFullScreen].CreateToolItem() as ToolItem;
                t_item.IsImportant = true;
                tbar.Insert(t_item, -1);

                Gtk.Action action = new PreviousPictureAction(View.Item);
                actions.Add(action);
                tbar.Insert(action.CreateToolItem() as ToolItem, -1);

                play_pause_button = actions[SlideShow].CreateToolItem() as ToolButton;
                tbar.Insert(play_pause_button, -1);

                action = new NextPictureAction(View.Item);
                actions.Add(action);
                tbar.Insert(action.CreateToolItem() as ToolItem, -1);

                t_item = new ToolItem {
                    Child = new Label(Strings.SlideTransitionColon)
                };
                tbar.Insert(t_item, -1);

                display = new SlideShow(View.Item);
                display.AddEvents((int)Gdk.EventMask.PointerMotionMask);
                display.ModifyBg(Gtk.StateType.Normal, Style.Black);
                display.MotionNotifyEvent += HandleViewMotion;
                display.Show();

                t_item = new ToolItem();
                ComboBox combo = ComboBox.NewText();
                foreach (var transition in display.Transitions)
                {
                    combo.AppendText(transition.Name);
                }

                combo.Active   = 0;
                combo.Changed += HandleTransitionChanged;
                t_item.Child   = combo;
                tbar.Insert(t_item, -1);

                action = new RotateLeftAction(View.Item);
                actions.Add(action);
                tbar.Insert(action.CreateToolItem() as ToolItem, -1);

                action = new RotateRightAction(View.Item);
                actions.Add(action);
                tbar.Insert(action.CreateToolItem() as ToolItem, -1);

                info_button = (ToggleToolButton)(actions[Info].CreateToolItem() as ToolItem);
                tbar.Insert(info_button, -1);

                tbar.Insert(actions[HideToolbar].CreateToolItem() as ToolItem, -1);

                notebook.AppendPage(scroll, null);
                notebook.AppendPage(display, null);

                tbar.ShowAll();

                scroll.Show();
                Decorated = false;
                Fullscreen();
                ButtonPressEvent += HandleButtonPressEvent;

                View.Item.Changed += HandleItemChanged;
                View.GrabFocus();

                //hide_cursor_delay = new DelayedOperation (3000, new GLib.IdleHandler (HideCursor));
                //hide_cursor_delay.Start ();

                controls = new ControlOverlay(this);
                controls.Add(tbar);
                controls.Dismiss();

                notebook.CurrentPage = 0;
            } catch (Exception e) {
                Log.Exception(e);
            }
        }
Exemple #17
0
 protected virtual void OnSetScreenRegion(Gdk.Screen screen, Gdk.Rectangle region)
 {
     return;
 }
Exemple #18
0
        public static bool IsComposited (Screen screen)
        {
            bool composited;
            try {
                composited = gdk_screen_is_composited (screen.Handle);
            } catch (EntryPointNotFoundException) {
                Atom atom = Atom.Intern (String.Format ("_NET_WM_CM_S{0}", screen.Number), false);
                composited = Gdk.Selection.OwnerGetForDisplay (screen.Display, atom) != null;
            }

            // FIXME check for WINDOW_OPACITY so that we support compositing on older composite manager
            // versions before they started supporting the real check given above
            if (!composited) {
                composited = CompositeUtils.SupportsHint (screen, "_NET_WM_WINDOW_OPACITY");
            }

            return composited;
        }
Exemple #19
0
 public X11NotificationArea(string name, Gdk.Screen screen)
 {
     Title  = name;
     Screen = screen;
     Init();
 }
        public static Cms.Profile GetScreenProfile(Screen screen)
        {
            Atom atype;
            int  aformat;
            int  alength;
            byte [] data;

            if (Gdk.Property.Get (screen.RootWindow,
                          Atom.Intern ("_ICC_PROFILE", false),
                          Atom.Intern ("CARDINAL", false),
                          0,
                          Int32.MaxValue,
                          0, // FIXME in gtk# should be a bool
                          out atype,
                          out aformat,
                          out alength,
                          out data)) {
                return new Cms.Profile (data);
            }

            return null;
        }
 public static void SetScreenProfile(Screen screen, Cms.Profile profile)
 {
     byte [] data = profile.Save ();
     ChangeProperty (screen.RootWindow,
             Atom.Intern ("_ICC_PROFILE", false),
             Atom.Intern ("CARDINAL", false),
             PropMode.Replace,
             data);
 }
 protected override void OnScreenChanged(Gdk.Screen previous_screen)
 {
     base.OnScreenChanged(previous_screen);
     CheckScreenColormap();
 }
Exemple #23
0
 public void SetGeometryHints(Screen screen, int x, int y)
 {
     hints["x"] = x;
     hints["y"] = y;
     hints["xdisplay"] = screen.MakeDisplayName ();
     Update ();
 }
Exemple #24
0
        public FullScreenView(IBrowsableCollection collection, Gtk.Window parent) : base("Full Screen Mode")
        {
            //going fullscreen on the same screen the parent window
            Gdk.Screen screen  = Screen;
            int        monitor = screen.GetMonitorAtWindow(parent.GdkWindow);

            Gdk.Rectangle bounds = screen.GetMonitorGeometry(monitor);
            Move(bounds.X, 0);


            string style = "style \"test\" {\n" +
                           "GtkToolbar::shadow_type = GTK_SHADOW_NONE\n" +
                           "}\n" +
                           "class \"GtkToolbar\" style \"test\"";

            Gtk.Rc.ParseString(style);

            Name = "FullscreenContainer";
            try {
                //scroll = new Gtk.ScrolledWindow (null, null);
                actions = new ActionGroup("joe");

                actions.Add(new ActionEntry [] {
                    new ActionEntry(HideToolbar, Stock.Close,
                                    Catalog.GetString("Hide"),
                                    null,
                                    Catalog.GetString("Hide Toolbar"),
                                    HideToolbarAction)
                });

                actions.Add(new ToggleActionEntry [] {
                    new ToggleActionEntry(Info,
                                          Stock.Info,
                                          Catalog.GetString("Info"),
                                          null,
                                          Catalog.GetString("Image Information"),
                                          InfoAction,
                                          false)
                });

                Gtk.Action exit_full_screen = new Gtk.Action(ExitFullScreen,
                                                             Catalog.GetString("Exit fullscreen"),
                                                             null,
                                                             null);
#if GTK_2_10
                exit_full_screen.IconName = "view-restore";
#endif
                exit_full_screen.Activated += ExitAction;
                actions.Add(exit_full_screen);

                Gtk.Action slide_show = new Gtk.Action(SlideShow,
                                                       Catalog.GetString("Slideshow"),
                                                       Catalog.GetString("Start slideshow"),
                                                       null);
#if GTK_2_10
                slide_show.IconName = "media-playback-start";
#endif
                slide_show.Activated += SlideShowAction;
                actions.Add(slide_show);

                new Fader(this, 1.0, 3);
                notebook            = new Notebook();
                notebook.ShowBorder = false;
                notebook.ShowTabs   = false;
                notebook.Show();

                scroll = new ScrolledView();
                scroll.ScrolledWindow.SetPolicy(PolicyType.Never, PolicyType.Never);
                view = new PhotoImageView(collection);
                // FIXME this should be handled by the new style setting code
                view.ModifyBg(Gtk.StateType.Normal, this.Style.Black);
                this.Add(notebook);
                view.Show();
                view.MotionNotifyEvent += HandleViewMotion;
                view.PointerMode        = ImageView.PointerModeType.Scroll;

                scroll.ScrolledWindow.Add(view);

                Toolbar tbar = new Toolbar();
                tbar.ToolbarStyle = Gtk.ToolbarStyle.BothHoriz;

                tbar.ShowArrow   = false;
                tbar.BorderWidth = 15;

                ToolItem t_item = (actions [ExitFullScreen]).CreateToolItem() as ToolItem;
                t_item.IsImportant = true;
                tbar.Insert(t_item, -1);

                Gtk.Action action = new PreviousPictureAction(view.Item);
                actions.Add(action);
#if GTK_2_10
                tbar.Insert(action.CreateToolItem() as ToolItem, -1);
#else
                t_item = action.CreateToolItem() as ToolItem;
                (t_item as ToolButton).IconName = "gtk-go-back-ltr";
                tbar.Insert(t_item, -1);
#endif

                play_pause_button = (actions [SlideShow]).CreateToolItem() as ToolButton;
#if GTK_2_10
                tbar.Insert(play_pause_button, -1);
#else
                play_pause_button.IconName = "media-playback-start";
                tbar.Insert(play_pause_button, -1);
#endif

                action = new NextPictureAction(view.Item);
                actions.Add(action);
#if GTK_2_10
                tbar.Insert(action.CreateToolItem() as ToolItem, -1);
#else
                t_item = action.CreateToolItem() as ToolItem;
                (t_item as ToolButton).IconName = "gtk-go-forward-ltr";
                tbar.Insert(t_item, -1);
#endif

                t_item       = new ToolItem();
                t_item.Child = new Label(Catalog.GetString("Slide transition:"));
                tbar.Insert(t_item, -1);

                display = new TextureDisplay(view.Item);
                display.AddEvents((int)(Gdk.EventMask.PointerMotionMask));
                display.ModifyBg(Gtk.StateType.Normal, this.Style.Black);
                display.MotionNotifyEvent += HandleViewMotion;
                display.Show();

                t_item       = new ToolItem();
                t_item.Child = display.GetCombo();
                tbar.Insert(t_item, -1);

                action = new RotateLeftAction(view.Item);
                actions.Add(action);
#if GTK_2_10
                tbar.Insert(action.CreateToolItem() as ToolItem, -1);
#else
                t_item = action.CreateToolItem() as ToolItem;
                (t_item as ToolButton).IconName = "object-rotate-left";
                tbar.Insert(t_item, -1);
#endif

                action = new RotateRightAction(view.Item);
                actions.Add(action);
#if GTK_2_10
                tbar.Insert(action.CreateToolItem() as ToolItem, -1);
#else
                t_item = action.CreateToolItem() as ToolItem;
                (t_item as ToolButton).IconName = "object-rotate-right";
                tbar.Insert(t_item, -1);
#endif

                info_button = (ToggleToolButton)((actions [Info]).CreateToolItem() as ToolItem);
                tbar.Insert(info_button, -1);

                tbar.Insert((actions [HideToolbar]).CreateToolItem() as ToolItem, -1);

                notebook.AppendPage(scroll, null);
                notebook.AppendPage(display, null);

                tbar.ShowAll();

                scroll.Show();
                this.Decorated = false;
                this.Fullscreen();
                this.ButtonPressEvent += HandleButtonPressEvent;

                view.Item.Changed += HandleItemChanged;
                view.GrabFocus();

                hide_cursor_delay = new Delay(3000, new GLib.IdleHandler(HideCursor));
                hide_cursor_delay.Start();

                controls = new ControlOverlay(this);
                controls.Add(tbar);
                controls.Dismiss();

                notebook.CurrentPage = 0;
            } catch (System.Exception e) {
                Log.Exception(e);
            }
        }